Search in sources :

Example 6 with ActiveMQMapMessage

use of org.apache.activemq.command.ActiveMQMapMessage in project nifi by apache.

the class TestJmsConsumer method createMapMessage.

protected static MapMessage createMapMessage() throws JMSException {
    MapMessage mapMessage = new ActiveMQMapMessage();
    mapMessage.setString("name", "Arnold");
    mapMessage.setInt("age", 97);
    mapMessage.setDouble("xyz", 89686.564);
    mapMessage.setBoolean("good", true);
    return mapMessage;
}
Also used : ActiveMQMapMessage(org.apache.activemq.command.ActiveMQMapMessage) ActiveMQMapMessage(org.apache.activemq.command.ActiveMQMapMessage) MapMessage(javax.jms.MapMessage)

Example 7 with ActiveMQMapMessage

use of org.apache.activemq.command.ActiveMQMapMessage in project activemq-artemis by apache.

the class ActiveMQMapMessageTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ActiveMQMapMessage info = (ActiveMQMapMessage) object;
}
Also used : ActiveMQMapMessage(org.apache.activemq.command.ActiveMQMapMessage)

Example 8 with ActiveMQMapMessage

use of org.apache.activemq.command.ActiveMQMapMessage in project activemq-artemis by apache.

the class ActiveMQMapMessageTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    ActiveMQMapMessage info = (ActiveMQMapMessage) object;
}
Also used : ActiveMQMapMessage(org.apache.activemq.command.ActiveMQMapMessage)

Example 9 with ActiveMQMapMessage

use of org.apache.activemq.command.ActiveMQMapMessage in project rocketmq-externals by apache.

the class ActivemqSourceTaskTest method getMessageConnentTest.

@Test(expected = RuntimeException.class)
public void getMessageConnentTest() throws JMSException {
    String value = "hello rocketmq";
    ActivemqSourceTask task = new ActivemqSourceTask();
    TextMessage textMessage = new ActiveMQTextMessage();
    textMessage.setText(value);
    ByteBuffer buffer = task.getMessageConnent(textMessage);
    Assert.assertEquals(new String(buffer.array()), textMessage.getText());
    ObjectMessage objectMessage = new ActiveMQObjectMessage();
    objectMessage.setObject(value);
    buffer = task.getMessageConnent(objectMessage);
    Assert.assertEquals(new String(buffer.array()), "\"" + objectMessage.getObject().toString() + "\"");
    BytesMessage bytes = new ActiveMQBytesMessage();
    bytes.writeBytes(value.getBytes());
    bytes.reset();
    buffer = task.getMessageConnent(bytes);
    Assert.assertEquals(new String(buffer.array()), value);
    MapMessage mapMessage = new ActiveMQMapMessage();
    mapMessage.setString("hello", "rocketmq");
    buffer = task.getMessageConnent(mapMessage);
    Map<String, String> map = JSON.parseObject(buffer.array(), Map.class);
    Assert.assertEquals(map.get("hello"), "rocketmq");
    Assert.assertEquals(map.size(), 1);
    StreamMessage streamMessage = new ActiveMQStreamMessage();
    String valueTwo = null;
    for (int i = 0; i < 200; i++) {
        valueTwo = valueTwo + value;
    }
    streamMessage.writeBytes(valueTwo.getBytes());
    streamMessage.reset();
    buffer = task.getMessageConnent(streamMessage);
    Assert.assertEquals(new String(buffer.array()), valueTwo);
    task.getMessageConnent(null);
}
Also used : ActiveMQMapMessage(org.apache.activemq.command.ActiveMQMapMessage) ActiveMQObjectMessage(org.apache.activemq.command.ActiveMQObjectMessage) MapMessage(javax.jms.MapMessage) ActiveMQMapMessage(org.apache.activemq.command.ActiveMQMapMessage) ActiveMQBytesMessage(org.apache.activemq.command.ActiveMQBytesMessage) BytesMessage(javax.jms.BytesMessage) ActiveMQStreamMessage(org.apache.activemq.command.ActiveMQStreamMessage) ByteBuffer(java.nio.ByteBuffer) ActiveMQTextMessage(org.apache.activemq.command.ActiveMQTextMessage) ObjectMessage(javax.jms.ObjectMessage) ActiveMQObjectMessage(org.apache.activemq.command.ActiveMQObjectMessage) ActiveMQBytesMessage(org.apache.activemq.command.ActiveMQBytesMessage) StreamMessage(javax.jms.StreamMessage) ActiveMQStreamMessage(org.apache.activemq.command.ActiveMQStreamMessage) ActiveMQTextMessage(org.apache.activemq.command.ActiveMQTextMessage) TextMessage(javax.jms.TextMessage) Test(org.junit.Test)

Aggregations

ActiveMQMapMessage (org.apache.activemq.command.ActiveMQMapMessage)9 ActiveMQBytesMessage (org.apache.activemq.command.ActiveMQBytesMessage)4 ActiveMQObjectMessage (org.apache.activemq.command.ActiveMQObjectMessage)4 ActiveMQStreamMessage (org.apache.activemq.command.ActiveMQStreamMessage)4 ActiveMQTextMessage (org.apache.activemq.command.ActiveMQTextMessage)4 MapMessage (javax.jms.MapMessage)3 BytesMessage (javax.jms.BytesMessage)2 StreamMessage (javax.jms.StreamMessage)2 ActiveMQMessage (org.apache.activemq.command.ActiveMQMessage)2 Test (org.junit.Test)2 ByteBuffer (java.nio.ByteBuffer)1 Message (javax.jms.Message)1 MessageConsumer (javax.jms.MessageConsumer)1 MessageProducer (javax.jms.MessageProducer)1 ObjectMessage (javax.jms.ObjectMessage)1 TextMessage (javax.jms.TextMessage)1 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)1 MessageId (org.apache.activemq.command.MessageId)1