9 Replies Latest reply on May 6, 2010 6:36 AM by timfox

    Message ordering within Topic

    mayankmit2002

      Hello,

         We have a system where we are highly dependent upon the message ordering on topic fired from the server, but we are just unable to achieve this as in JBM topic doesn't support strict message ordering.

      Does, HornetQ supports strict message ordering for topic.

       

      Following is the link to my previous post, in which Howard suggested me to come here.

       

      https://community.jboss.org/message/538621#538621

       

      System Description

           JBoss AS 4.2.3GA

           Sun Java 1.6.0u18

       

      Work Flow

      1. User performs some operation on the client.
      2. against each change in values in the database (that changes the state of the database), we are firing events to a queue.
      3. Events from the queue are listened by callback listener on the server to execute callback operations.
      4. Once Callback operation is executed, the event is then fired to a public topic,
      5. A MDB is also there, listing to public topic.
      6. Other JMS clients are also there to perform operations on receiving messages.

       

      Now, in the whole work flow, we have noticed that number of times order of messages received at the clients end are different from that in what they were actually fired.

       

      So, we are looking for a solution that guarantee the ordering of messages for topic.

        • 1. Re: Message ordering within Topic
          ataylor

          Is it the callback listener or the MDB that is the client receiving messages out of order?

          • 2. Re: Message ordering within Topic
            mayankmit2002

            No, itz Topic clients which are receiving messages our of order.

            • 3. Re: Message ordering within Topic
              ataylor

              Actually I didn't realize you were taling about topics. The issue with strict ordering is a queue issue, this is because you can have multiple consumers on a queue, i.e a pool of MDB's, but cant control ordering strictly as different consumers consume at different rates. With topics, every subscriber receives every message, The only way a message would be received out of order was if it was redelivered somehow.

               

              maybe i am not understanding your topology properly?

              • 4. Re: Message ordering within Topic
                timfox

                Andy is right, strict ordering on a topic doesn't really make any sense.

                 

                The whole point of a topic is that each subscriber gets a copy of a message which is consumed in parallel.

                 

                If messages are consumed in parallel, how can you have strict ordering.

                 

                I think what is lacking here is a details description of what the user means by strict ordering on a topic.

                • 5. Re: Message ordering within Topic
                  mayankmit2002
                  I think what is lacking here is a details description of what the user means by strict ordering on a topic.

                       Actually, what message ordering meant here is, let say, on completion of within a transaction we are firing 4 events E1, E2, E3 and E4 on a topic, then others client should should receive events in the same order i.e. E1,E2,E3 and E4.

                       But, in our case, most of time , we receives event in the same order,but times we lost the order.

                   

                  Andy is right, strict ordering on a topic doesn't really make any sense.

                   

                  what I understand from your comment is that, strict ordering of messages is not possible with topic and is not recommended as well, but our problem is that we any how need to perform operations in the order, the events were fired from the server,

                    Is there any best way you can suggest, which we can use to solve our problem.

                  • 6. Re: Message ordering within Topic
                    timfox

                    Ok, I think what you mean is a strict ordering for topic *subscribers* not a strict ordering over the entire topic (which wouldn't make a lot of sense).

                     

                    You want each topic subscriber to receive messages in the order they were sent from a particular producer.

                     

                    This requirement is already guaranteed by both JBoss Messaging and HornetQ, since it's a requirement of the JMS spec (see section on ordering guarantees in JMS spec).

                     

                    If you can provide a test case demonstrating where this is not occurring, we can take a look.

                    • 7. Re: Message ordering within Topic
                      ataylor

                      I still dont fully understand what yoe mean. If you have 1 producer sending message m1, m2, m3, m4 to a topic in the scope of a transaction then all subscribers will receive these in that order unless 1 or more of the messages are redelivered for some reason. Are you saying this is not the case?

                      • 8. Re: Message ordering within Topic
                        mayankmit2002

                        Yes, it is like that, but not alwayz...

                        Most of the time, subscriers receives messages in the order, but other times order gets disturbed.

                        • 9. Re: Message ordering within Topic
                          timfox

                          This is all very vague.

                           

                          If you think there is an issue, please submit a test program that demonstrates it, and we will investigate.