jmsactivemq-artemisamq

Does ActiveMQ Artemis / RedHat AMQ not set JMS Message ID correctly?


According to the JMS spec, I do not have to specify the message ID when sending.

When I send a message via JMSProducer#send() or when I create a message via the hawt.io console, I can see the message ID being set to some internal sequential number generated by the Artemis broker.

However, when I use MessageConsumer#receive() or MessageListener#onMessage() to receive a Message, Message#getJMSMessageID() always returns null.

The only way I can receive a message with a non-null JMS message ID is by reading a message from a different (IBM) message queue and copying all its properties to the Artemis message before sending it.

I have tested this with both AMQ 7.3.0.GA and Apache ActiveMQ Artemis 2.6.2, with both native (org.apache.activemq.artemis-jms-client) and AMQP (org.apache.qpid.qpid-jms-client) clients.

Is there some configuration I must set on the broker to make it populate JMS message IDs correctly?


Solution

    1. JMS Message ID is usually stored in a native Artemis header that is called userID
    2. Messages sent via the management console do not populate userID
    3. Messages sent via the Core JMS client do populate the message ID
    4. Messages sent via the Qpid client populate a custom property NATIVE_MESSAGE_ID with the JMS message ID
    5. There's no way to obtain the internal message ID via JMS
    6. If you send a message via Qpid and read it via Core client or vice versa you will receive a null JMS message ID