1 Reply Latest reply on Mar 20, 2011 2:58 AM by Ravisankar Challa

    Guaranteeing message order consumption

    anonimo Newbie

      I have a system that sends messages to a HornetQ server, and these are exposed via a topic. There are two subscribers of that topic, and for one of them it is very important to get messages in the right order.


      This consumer is implemented as an MDB, and for guarateeing order in this side, I set the MDB pool size to 1, so that no multiple instances can consume in different order to the one messages are published.


      My question is whether it is possible to guarantee this publishing in strict order in the server side (HornetQ).



        • 1. Guaranteeing message order consumption
          Ravisankar Challa Newbie

          Hi Anonimo,


          Can i put your question in this way, how to acheive strict message ordering out of the box, no matter how many consumers are there on the destination is this correct?


          I guess there is no JMS provider (either open source or proprietary) that had an out of the box feature to address this.


          I feel in order to maintain strict ordering there should be always only one consumer on the destination listening for messages. If you think that having a signgle consumer reduces the throughput of your application then take a look at Message Grouping feature implemented in HornetQ (note:This feature is not part of JMS Specification).


          But this requires some code change on your producer, producer has to set a JMS Message Header on all the message it is sending to the destination.  That messae header is JMSXGroupID (this should be unique group id).


          Please have a look at http://hornetq.sourceforge.net/docs/hornetq-2.0.0.GA/user-manual/en/html/message-grouping.html


          Note: I implemented this feature using Queues succesfully not sure will this work for "Topics".



          Ravisankar C