Search in sources :

Example 11 with ActiveMQMessage

use of org.apache.activemq.artemis.jms.client.ActiveMQMessage in project midpoint by Evolveum.

the class TestAsyncProvisioningArtemis method getRequest.

@Override
protected String getRequest() throws JMSException {
    Message msg = consumer.receiveNoWait();
    displayValue("Message received", msg);
    if (msg instanceof TextMessage) {
        String text = ((TextMessage) msg).getText();
        displayValue("Message " + msg.getJMSMessageID(), text);
        return text;
    } else if (msg instanceof ActiveMQMessage) {
        ClientMessage coreMessage = ((ActiveMQMessage) msg).getCoreMessage();
        String text = coreMessage.getBodyBuffer().readUTF();
        displayValue("Message " + coreMessage.getMessageID(), text);
        return text;
    } else {
        return null;
    }
}
Also used : ActiveMQMessage(org.apache.activemq.artemis.jms.client.ActiveMQMessage) ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) ActiveMQMessage(org.apache.activemq.artemis.jms.client.ActiveMQMessage)

Aggregations

ActiveMQMessage (org.apache.activemq.artemis.jms.client.ActiveMQMessage)11 Message (javax.jms.Message)5 TextMessage (javax.jms.TextMessage)5 ClientMessage (org.apache.activemq.artemis.api.core.client.ClientMessage)5 Test (org.junit.Test)4 BytesMessage (javax.jms.BytesMessage)3 Session (javax.jms.Session)3 Connection (javax.jms.Connection)2 MapMessage (javax.jms.MapMessage)2 MessageProducer (javax.jms.MessageProducer)2 ObjectMessage (javax.jms.ObjectMessage)2 StreamMessage (javax.jms.StreamMessage)2 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)2 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)2 ClientMessageImpl (org.apache.activemq.artemis.core.client.impl.ClientMessageImpl)2 ActiveMQBytesMessage (org.apache.activemq.artemis.jms.client.ActiveMQBytesMessage)2 ActiveMQMapMessage (org.apache.activemq.artemis.jms.client.ActiveMQMapMessage)2 ActiveMQObjectMessage (org.apache.activemq.artemis.jms.client.ActiveMQObjectMessage)2 ActiveMQStreamMessage (org.apache.activemq.artemis.jms.client.ActiveMQStreamMessage)2 ActiveMQTextMessage (org.apache.activemq.artemis.jms.client.ActiveMQTextMessage)2