How can I get the jndi name of the source of a jms message
I am using the Spring Session Aware Message Listener to listen to multiple JMS queues. Is there any way to get the JNDI name of the source of an incoming message? I have tried to us开发者_开发技巧e the getJMSDestination, but this only gives me the display name.
Thank you.
I don't think you can. The source might not even have a JNDI name - if, for example the message is sent from the messaging provider console, or from spring (rather than from an app server).
I think the message doesn't hold any information about the sender, unless it manually includes it in the form of properties.
Update: The same goes for the destinations - they are uniquely identified by messaging provider name, which again may lack a JNDI name. For example I'm now using ActiveMQ with spring, and there are no JNDI names whatsoever. The JNDI name is the name by which the client refers to a certain Topic/Queue inside its container and is not an information stored in the JMS message.
精彩评论