Thanks Rob. The ThreadLocal idea from the referred link helps me to solved
the issue. Basically I use a ThreadLocal object to store the message before
send() is called and then use msg.getJMSMessageID() to log the id after
send() is called. This works perfect for me as I really don't need to
customize id if I can simply log it.

One more question, I noticed I do have the message id logged as well by qpid
when I turned on the DEBUG level on qpid jms. I initially thought the log is
from the consumer when it receives the message from the broker. But with the
application code logging the message id, it looks like the AmqpConsumer log
is actually called by the sender to log the message id?

2021-01-12 16:45:21,523 [AmqpProvider
:(1):[amqps://sbnagsrdv2usw.servicebus.windows.net:-1]] DEBUG   
o.a.qpid.jms.provider.amqp.AmqpConsumer - Dispatching received message:
JmsInboundMessageDispatch { sequence = 1, messageId =
ID:a1feef5c-2e14-4722-b880-9366571b990f:2:1:1-1, consumerId =
ID:5eec83ba-325e-413b-b00f-969ab30f3e5d:1:1:1 }
2021-01-12 16:45:36,790 DEBUG c.p.c.a.i.messaging.jms.JmsMessageSender -
MessageId: 'ID:a1feef5c-2e14-4722-b880-9366571b990f:2:1:1-1'



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to