Search in sources :

Example 6 with ActiveMQBytesMessage

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

the class ActiveMQBytesMessageTest method createObject.

@Override
public Object createObject() throws Exception {
    ActiveMQBytesMessage info = new ActiveMQBytesMessage();
    populateObject(info);
    return info;
}
Also used : ActiveMQBytesMessage(org.apache.activemq.command.ActiveMQBytesMessage)

Example 7 with ActiveMQBytesMessage

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

the class CompressionOverNetworkTest method testBytesMessageCompression.

@Test
public void testBytesMessageCompression() throws Exception {
    MessageConsumer consumer1 = remoteSession.createConsumer(included);
    MessageProducer producer = localSession.createProducer(included);
    producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
    waitForConsumerRegistration(localBroker, 1, included);
    StringBuilder payload = new StringBuilder("test-");
    for (int i = 0; i < 100; ++i) {
        payload.append(UUID.randomUUID().toString());
    }
    byte[] bytes = payload.toString().getBytes(StandardCharsets.UTF_8);
    BytesMessage test = localSession.createBytesMessage();
    test.writeBytes(bytes);
    producer.send(test);
    Message msg = consumer1.receive(RECEIVE_TIMEOUT_MILLS);
    assertNotNull(msg);
    ActiveMQBytesMessage message = (ActiveMQBytesMessage) msg;
    assertTrue(message.isCompressed());
    assertTrue(message.getContent().getLength() < bytes.length);
    byte[] result = new byte[bytes.length];
    assertEquals(bytes.length, message.readBytes(result));
    assertEquals(-1, message.readBytes(result));
    for (int i = 0; i < bytes.length; ++i) {
        assertEquals(bytes[i], result[i]);
    }
}
Also used : MessageConsumer(javax.jms.MessageConsumer) ActiveMQBytesMessage(org.apache.activemq.command.ActiveMQBytesMessage) MapMessage(javax.jms.MapMessage) ActiveMQTextMessage(org.apache.activemq.command.ActiveMQTextMessage) ActiveMQObjectMessage(org.apache.activemq.command.ActiveMQObjectMessage) Message(javax.jms.Message) ActiveMQMapMessage(org.apache.activemq.command.ActiveMQMapMessage) StreamMessage(javax.jms.StreamMessage) BytesMessage(javax.jms.BytesMessage) ActiveMQStreamMessage(org.apache.activemq.command.ActiveMQStreamMessage) ActiveMQBytesMessage(org.apache.activemq.command.ActiveMQBytesMessage) ActiveMQBytesMessage(org.apache.activemq.command.ActiveMQBytesMessage) BytesMessage(javax.jms.BytesMessage) MessageProducer(javax.jms.MessageProducer) Test(org.junit.Test)

Example 8 with ActiveMQBytesMessage

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

the class ActiveMQBytesMessageTest method populateObject.

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

Example 9 with ActiveMQBytesMessage

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

the class ActiveMQBytesMessageTest method populateObject.

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

Aggregations

ActiveMQBytesMessage (org.apache.activemq.command.ActiveMQBytesMessage)9 ActiveMQMapMessage (org.apache.activemq.command.ActiveMQMapMessage)3 ActiveMQObjectMessage (org.apache.activemq.command.ActiveMQObjectMessage)3 ActiveMQStreamMessage (org.apache.activemq.command.ActiveMQStreamMessage)3 ActiveMQTextMessage (org.apache.activemq.command.ActiveMQTextMessage)3 Test (org.junit.Test)3 BytesMessage (javax.jms.BytesMessage)2 ActiveMQMessage (org.apache.activemq.command.ActiveMQMessage)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 MapMessage (javax.jms.MapMessage)1 Message (javax.jms.Message)1 MessageConsumer (javax.jms.MessageConsumer)1 MessageProducer (javax.jms.MessageProducer)1 StreamMessage (javax.jms.StreamMessage)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 ProducerId (org.apache.activemq.command.ProducerId)1