On Tue, 12 Jan 2021 at 17:01, jxz024000 <zhoujia...@hotmail.com> wrote: > > 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. >
I dont really follow this. The ThreadLocal was a specific hack to provide a particular ID value for a custom ID generator to return once it was called on that thread by the client during send. If you already have the message object, and only want to get and log the client-provided ID after sending, and not customise the ID in any way, then you should already be able to do that simply without any hoops. What is the ThreadLocal being used for? > 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' > That first log is indeed a client log from a receiver with details of what it is handing on. The JmsInboundMessageDispatch object carries the decoded received AMQP message further into the client for handling and eventually delivery to applications, and some of its details are logged at debug as that occurs, including its message id. The second log is something from your application code, so I can't really say much there, having no knowledge what it does. If you receive a message and e.g log the details and then send it or something, it will of course match what the consumer got before the next send. > > > -- > Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org > For additional commands, e-mail: users-h...@qpid.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org For additional commands, e-mail: users-h...@qpid.apache.org