Results 1 to 3 of 3

Thread: how to get the JMS queue name from within a POJO message bean?

  1. #1
    Join Date
    Nov 2008
    Posts
    7

    Default 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. #2
    Join Date
    Jul 2008
    Posts
    26

    Default

    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

  3. #3
    Join Date
    Oct 2008
    Location
    Columbus, Ohio
    Posts
    10

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