When consuming a javax.jms.Message from IBM MQ I want to log the message id and destination it came from like this:
Received [ID:...] from [...]
For some messages this works fine and looks like this:
Received [ID:414d5120465030303030374920202020a948b66401d61440] from [queue://MYQMGR/MYQ]
But for some other queues on the same queue manager Message.getJMSDestination() returns null, and I get this:
Received [ID:414d512053415a324d5131452020202063c3b3fc9c229718] from [null]
- What is the reason for this?
- What can I do to fix it?
Details about my context:
- JEE7, Java 8
- MDB listens to MQ queue (onMessage(javax.jms.Message))
I guess that you are using logic akin to
In which case a null destination indicates that the message didn't come from a JMS application. IE. if the sender application was a Node.js making use of the MQI API then you would expect to see JMSDestination as null.