3 Replies Latest reply on Jul 16, 2014 9:17 AM by Miroslav Novak

    Guaranteed ordering of messges in HornetQ

    sankarts Newbie

      I am using WildFly Server 8,1.0 which has built-in HornetQ in it.

       

      My development environment has multiple producers as well as multiple consumers.

       

      My requirement is to have guaranteed sequencing of messages.

       

      My queries

       

      1) Similar to Message Unit-of-Order support in WebLog8ic JMS (please refer the pointer as below), is there any equivalent mechanism supported in HornetQ?

      http://docs.oracle.com/cd/E24329_01/web.1211/e24387/uoo.htm

       

      2) Whether message grouping ensures that all the messages of the group are always consumed by the same consumer.

      Does "Message Group" also support "guarranteed ordering of the processing of messages across the group"?

      ActiveMQ Message Group supports this, whereas there is no explicit mention w.r. to HornetQ Message Group.

       

      ActiveMQ Message Group:

      http://activemq.apache.org/message-groups.html

       

      HornetQ Message Group:

      Chapter 28. Message Grouping

       

      3) How about the proven &/ documented mechanism, by which message sequencing can be achieved.

       

      Thanks in advance,

      Shankar

        • 1. Re: Guaranteed ordering of messges in HornetQ
          Justin Bertram Master

          1) Similar to Message Unit-of-Order support in WebLog8ic JMS (please refer the pointer as below), is there any equivalent mechanism supported in HornetQ?

          Yes, I believe our "message group" feature is equivalent to this.

           

          2) Whether message grouping ensures that all the messages of the group are always consumed by the same consumer.

          Yes, a "message group" is bound to a particular consume until that consumer is closed and then another consumer is selected.

           

          Does "Message Group" also support "guarranteed ordering of the processing of messages across the group"?

          A single consumer can only process a single message at a time so the messages in the group will be consumed in order.

           

          3) How about the proven &/ documented mechanism, by which message sequencing can be achieved.

          I'm not sure what your asking here.  It sounds like you're just rephrasing your question about message grouping.  Please elaborate if you need further clarification on HornetQ message grouping.

          • 2. Re: Re: Guaranteed ordering of messges in HornetQ
            sankarts Newbie

            Thanks Justin for the quick response.

             

            My query

            Since my development environment has multiple producers as well as multiple consumers, to be specific WildFly cluster


            To elaborate, a cluster of 2 WildFly instances are running in standalone mode. Each WildFly server has been deployed with my custom MDB. When the messages are received by the cluster, by default, message load-balancing between both the WildFly/HornetQ servers happen.


            To achieve the "sequence of messages",

            While producing & sending, I make use of unique Group ID for all the related messages, so that they should get consumed by the same consumer and in the same order.

                    msg.setObject(myMsg);

             

                    msg.setStringProperty("JMSXGroupID", uniqueGroupId);


            In nutshell, I would like to support "Message Unit-of-Order" among WildFly/HornetQ cluster.


            I referred to 28.5 Clustered Grouping (please refer the link below), but not sure about how / where I can configure "grouping-handler" etc in "standalone-full-ha.xml"?


            Chapter 28. Message Grouping

            Any help / pointers on this would be appreciated.


            Thanks,

            Shankar

            • 3. Re: Re: Re: Guaranteed ordering of messges in HornetQ
              Miroslav Novak Master

              Just put this to first server:

               

              <subsystem xmlns="urn:jboss:domain:messaging:...">
              <hornetq-server>
              ...
              <grouping-handler name="my-grouping-handler">
                <type>LOCAL</type>
                <address>jms</address>
                <timeout>5000</timeout>
              </grouping-handler>
              ...
              
              </hornetq-server>
              </subsystem>
              
              

               

              and this to second server:

               

              <subsystem xmlns="urn:jboss:domain:messaging:...">
              <hornetq-server>
              ...
              <grouping-handler name="my-grouping-handler">
                <type>REMOTE</type>
                <address>jms</address>
                <timeout>5000</timeout>
              </grouping-handler>
              ...
              
              </hornetq-server>
              </subsystem>