1
votes

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?

1
Can you provide the client code you've tested with? I just ran a simple test with AMQ 7.3.0 by modifying the "queue" example (at examples/features/standard/queue) to print the JMS message ID after the message is sent and when it is received and everything worked as expected (i.e. the message ID was not null).Justin Bertram
@JustinBertram The problem was the Qpid and Core client store the ID in different headers, while the management console doesn't populate it at all.Alexey
The wording of your question doesn't make it clear that you're sending with one protocol and receiving with a different protocol.Justin Bertram

1 Answers

1
votes
  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