Announcement Announcement Module
Collapse
No announcement yet.
how to get the JMS queue name from within a POJO message bean? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #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

    Comment


    • #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

      Comment

      Working...
      X