4 Replies Latest reply on Dec 13, 2011 5:17 AM by Christos Vasilakis

    message-id STOMP

    Christos Vasilakis Newbie

      Hi there,


      I am using hornetq 2.2.5.Final together with STOMP on a remote C client (using libstomp). I am trying to implement a request-reply mechanism using JMSMessageID and JMSCorrelationID mesage headers


      I tried to use the message-id as the corellation-id on the C client but the message-id received though STOMP is



      message-id: 102758


      while  the JMSMessageID when printed on the producer is






      The way I solved it using a custom property on the producer (through UIID java class) and using that property as the corellation-id on the C client. Worked flawlessly but I want to ask why is this mismatch of the message-id between JMS and STOMP?


      Also I saw a UIID class on the hornetq libs org.hornetq.utils.UUID;  I used the java standard class java.util.UUID in my example but I am wondering if there is any difference?


      Regards and keep rocking the messaging space!

        • 1. Re: message-id STOMP
          Yong Hao Gao Master

          Did you try getting "correlation-id" header from the stomp frame?



          • 2. Re: message-id STOMP
            Christos Vasilakis Newbie

            Hi Howard,


            On the producer I *don't* set "setJMSCorrelationID" on the message. Only in the consumer, in my case the C client I set it to the JMSMessageID (in STOMP frame I thought it was the "message-id" header of the received message)


            An excerpt from the C client but you can get the idea.


            replyframe is the STOMP reply frame

            reqframe is the STOMP request frame e.g. message received from server


                  apr_hash_set(replyframe.headers, "correlation-id", APR_HASH_KEY_STRING, apr_hash_get(reqframe->headers, "message-id", APR_HASH_KEY_STRING));     


            But the "message-id" differs from "JMSMessageID" of the message sent.


            The way I solved is


            On the producer I set the

            message.setStringPoperty("UIID", java.util.UIID);


            and replacing the C code with

              apr_hash_set(replyframe.headers, "correlation-id", APR_HASH_KEY_STRING, apr_hash_get(reqframe->headers, "UIID", APR_HASH_KEY_STRING));



            But why the mismach on the message-id and the JMSMessageID on the received STOMP frame. Why they are not equal?

            Am i missing sth?



            • 3. Re: message-id STOMP
              Yong Hao Gao Master



              "JMSMessageID" is not mapped to "message-id" in HornetQ stomp frames. "message-id" corresponds to the internal long type id for the message.

              Currently hornetq doesn't try to copy "JMSMessageID" to the stomp frames so you can't get it from the received frames.



              • 4. Re: message-id STOMP
                Christos Vasilakis Newbie

                Thanks Howard for your reply