tags:

views:

32

answers:

1

Hello.

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.

A: 

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.

Bozho
I think the question was to figure out which of several queues the message arrived on, not where the message originated. So, one listener on multiple queues gets a message, which queue did it arrive on? OP can get the transport provider's name for the queue with getJMSDestination, but cannot get the JNDI name which represents the queue.
T.Rob
@T.Rob thanks, I added an update
Bozho