Search in sources :

Example 11 with ICoreMessage

use of org.apache.activemq.artemis.api.core.ICoreMessage in project activemq-artemis by apache.

the class JMSTransformationSpeedComparisonTest method testBodyOnlyMessage.

@Test
public void testBodyOnlyMessage() throws Exception {
    Message message = Proton.message();
    message.setBody(new AmqpValue("String payload for AMQP message conversion performance testing."));
    AMQPMessage encoded = new AMQPMessage(message);
    // Warm up
    for (int i = 0; i < WARM_CYCLES; ++i) {
        ICoreMessage intermediate = encoded.toCore();
        encode(AMQPConverter.getInstance().fromCore(intermediate));
    }
    long totalDuration = 0;
    long startTime = System.nanoTime();
    for (int i = 0; i < PROFILE_CYCLES; ++i) {
        ICoreMessage intermediate = encoded.toCore();
        encode(AMQPConverter.getInstance().fromCore(intermediate));
    }
    totalDuration += System.nanoTime() - startTime;
    LOG_RESULTS(totalDuration);
}
Also used : ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) Message(org.apache.qpid.proton.message.Message) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) AmqpValue(org.apache.qpid.proton.amqp.messaging.AmqpValue) Test(org.junit.Test)

Example 12 with ICoreMessage

use of org.apache.activemq.artemis.api.core.ICoreMessage in project activemq-artemis by apache.

the class JMSTransformationSpeedComparisonTest method testTypicalQpidJMSMessageOutBoundOnly.

@Test
public void testTypicalQpidJMSMessageOutBoundOnly() throws Exception {
    AMQPMessage encoded = encode(createTypicalQpidJMSMessage());
    // Warm up
    for (int i = 0; i < WARM_CYCLES; ++i) {
        ICoreMessage intermediate = encoded.toCore();
        encode(AMQPConverter.getInstance().fromCore(intermediate));
    }
    long totalDuration = 0;
    long startTime = System.nanoTime();
    for (int i = 0; i < PROFILE_CYCLES; ++i) {
        ICoreMessage intermediate = encoded.toCore();
        encode(AMQPConverter.getInstance().fromCore(intermediate));
    }
    totalDuration += System.nanoTime() - startTime;
    LOG_RESULTS(totalDuration);
}
Also used : ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) Test(org.junit.Test)

Example 13 with ICoreMessage

use of org.apache.activemq.artemis.api.core.ICoreMessage in project activemq-artemis by apache.

the class JMSTransformationSpeedComparisonTest method testComplexQpidJMSMessage.

@Test
public void testComplexQpidJMSMessage() throws Exception {
    AMQPMessage encoded = encode(createComplexQpidJMSMessage());
    // Warm up
    for (int i = 0; i < WARM_CYCLES; ++i) {
        ICoreMessage intermediate = encoded.toCore();
        encode(AMQPConverter.getInstance().fromCore(intermediate));
    }
    long totalDuration = 0;
    long startTime = System.nanoTime();
    for (int i = 0; i < PROFILE_CYCLES; ++i) {
        ICoreMessage intermediate = encoded.toCore();
        encode(AMQPConverter.getInstance().fromCore(intermediate));
    }
    totalDuration += System.nanoTime() - startTime;
    LOG_RESULTS(totalDuration);
}
Also used : ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) AMQPMessage(org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage) Test(org.junit.Test)

Example 14 with ICoreMessage

use of org.apache.activemq.artemis.api.core.ICoreMessage in project activemq-artemis by apache.

the class PageTest method addPageElements.

/**
 * @param simpleDestination
 * @param page
 * @param numberOfElements
 * @return
 * @throws Exception
 */
protected void addPageElements(final SimpleString simpleDestination, final Page page, final int numberOfElements) throws Exception {
    int initialNumberOfMessages = page.getNumberOfMessages();
    for (int i = 0; i < numberOfElements; i++) {
        ICoreMessage msg = new CoreMessage().initBuffer(100);
        for (int j = 0; j < 10; j++) {
            msg.getBodyBuffer().writeByte((byte) 'b');
        }
        msg.setAddress(simpleDestination);
        page.write(new PagedMessageImpl(msg, new long[0]));
        Assert.assertEquals(initialNumberOfMessages + i + 1, page.getNumberOfMessages());
    }
}
Also used : ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) PagedMessageImpl(org.apache.activemq.artemis.core.paging.impl.PagedMessageImpl) CoreMessage(org.apache.activemq.artemis.core.message.impl.CoreMessage) ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage)

Example 15 with ICoreMessage

use of org.apache.activemq.artemis.api.core.ICoreMessage in project activemq-artemis by apache.

the class PagingManagerImplTest method createMessage.

protected ICoreMessage createMessage(final long messageId, final SimpleString destination, final ByteBuffer buffer) {
    ICoreMessage msg = new CoreMessage(messageId, 200);
    msg.setAddress(destination);
    msg.getBodyBuffer().writeBytes(buffer);
    return msg;
}
Also used : ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage) CoreMessage(org.apache.activemq.artemis.core.message.impl.CoreMessage) ICoreMessage(org.apache.activemq.artemis.api.core.ICoreMessage)

Aggregations

ICoreMessage (org.apache.activemq.artemis.api.core.ICoreMessage)39 Test (org.junit.Test)24 AMQPMessage (org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage)17 CoreMessage (org.apache.activemq.artemis.core.message.impl.CoreMessage)10 AmqpValue (org.apache.qpid.proton.amqp.messaging.AmqpValue)10 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)9 Message (org.apache.qpid.proton.message.Message)7 ApplicationProperties (org.apache.qpid.proton.amqp.messaging.ApplicationProperties)6 MessageImpl (org.apache.qpid.proton.message.impl.MessageImpl)6 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)5 Configuration (org.apache.activemq.artemis.core.config.Configuration)4 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)4 ServerJMSBytesMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSBytesMessage)3 ServerJMSMapMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSMapMessage)3 ServerJMSStreamMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSStreamMessage)3 ServerJMSTextMessage (org.apache.activemq.artemis.protocol.amqp.converter.jms.ServerJMSTextMessage)3 HashMap (java.util.HashMap)2 ClientMessageImpl (org.apache.activemq.artemis.core.client.impl.ClientMessageImpl)2 PagedMessage (org.apache.activemq.artemis.core.paging.PagedMessage)2 LargeServerMessage (org.apache.activemq.artemis.core.server.LargeServerMessage)2