Announcement Announcement Module
Collapse
No announcement yet.
Using JmsTemplate retrieving the JMSMessageID Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using JmsTemplate retrieving the JMSMessageID

    Hi Guys,

    I am using SI 1.0.4 and using spring jmsTemplate to post the message. I need to do two different things here

    1) Client post the message over queue and wait for reply on some topic.
    2) Client post the message and forget and listen on the same topic above( its a shared one ).

    Question1- How do i get the jmsMessageID when I have posted the message? I want this to make sure that I get only the reply messages that I have posted and should not pick all msgs on Topic.

    What I know- from forums -

    a) I know there is a way to get the jmsMessageID by implementing messageCreator interface.
    b) another is postprocessor way and getting the JmsMessageID.

    Can someone please reply that which one is better and if there is any other effective way?

    Thanks in advance.

  • #2
    Guys,
    As per post above, I tried implmenting messageCreator and

    I call jmsTemplate.send( messaeCreator) and then have exposed the method getMessageID inside my class which

    public String getMessageId() throws Exception {
    return textMessage.getJMSMessageID();
    //returns ID:EMS-****.3ACC4C06016144C:1
    }

    This does return a JMsID but when JMS adaptor receives this message, the JMS id is different in headers. ---
    springintegration_jms_messageId=ID:EMS-****.3ACC4C06016144A:2

    Does anyone know how can i get the JmsMessageID which I can use to correlate the response?

    I do set the JmsCorrelation ID in response message but that is of no use as messageID that I have on client side is different than the SPring is having...


    Any pointer will be great!

    Comment


    • #3
      The JMS Message ID is typically generated by the JMS broker itself.

      Comment


      • #4
        Agree, I thought messagecreator is callback thing and once the message is posted the information is poulated to messagecreator instance.

        I was trying to use messagecreator instance after the message is posted. And in theory, this should have given the info correctly.

        And, second thing is - how would it have got similar kind of ID, though different to the SI-JMSHeader value?

        Do you have some other idea to achieve this?

        Comment

        Working...
        X