简体   繁体   中英

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 use 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM