-
Nov 11th, 2008, 03:01 PM
#1
how to get the JMS queue name from within a POJO message bean?
Our JMS integration with Spring follows the common path of having a DefaultMessageListenerContainer -> MessageListenerAdapter -> POJO.
The POJO is used for multiple destinations. I would like to know, inside the POJO, where the message came from. The directly available data doesn't contain this piece of information, the only method on the POJO is public void handleMessage(Object message).
How can I retrieve the queue name, though? Is there any support in Spring I am not aware of? I searched in "Spring in Action", but didn't find an answer.
Thanks,
JL
-
Nov 11th, 2008, 10:46 PM
#2
As long as the JMS headers are intact, you should be able to grab the destination name from the JMSDestination property on the message.
Bruce
-
Nov 13th, 2008, 09:03 AM
#3
I think this should work
Hi,
try this
String queueNm = ((ActiveMQQueue)jmsMsg.getJMSDestination)).getPhys icalName();
and for topic
String topic = ((ActiveMQTopic)jmsMsg.getJMSDestination()).getTop icName();
Thanks
shishir
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules