2 Replies Latest reply on Aug 28, 2013 5:32 AM by nva

    Order of message broadcasts preserved?

    nva Newbie

      Would just like to confirm whether or not the order of broadcasts on the server bus are preserved. A very simple example: server broadcasts something on subject A and immediately broadcasts on subject B. A client is subscribed to both subjects, A and B. Is it guaranteed that A is always received before B?

       

      From experience I can see that A is usually received before B. However, is it guaranteed and can I base a contract between the client and the service on it?

       

      Many thanks!

       

      Cheers,

       

      V.

        • 1. Re: Order of message broadcasts preserved?
          Jonathan Fuerth Master

          Hi Valentin,

           

          Although messages are usually delivered in the order they were sent, Errai Bus does not guarantee ordering of messages. In fact, it does not guarantee delivery either. I've noticed that a message is often dropped when a client polls the server and gets a SessionExpired response, for example.

           

          IMO, ErraiBus should guarantee ordering, and at least notify the receiver if a message was lost in transmission. The problem with guaranteeing delivery is that you need to either impose a delivery time limit, or store undeliverable messages until the recipient comes back (possibly forever!) This could pile up fast if the server was sending broadcasts to thousands of clients and there was some sort of network outage near the server that caused all the clients to disconnect simultaneously!

           

          Anyway, changes to the message delivery contract aren't currently in the works–my advice is to come up with your own system for detecting lost or out-of-order messages when that's important to your use case. One method would be to set a sequence number on each message, and verify it on the receiving end.

           

          -Jonathan

          • 2. Re: Order of message broadcasts preserved?
            nva Newbie

            Thanks Jonathan for the clarification! Will design around this constraint.

             

            In my opinion there are uses for both, guaranteed and not-guaranteed message delivery. Ideal would be if messages or queues could be configured for point-to-point or publish-subscribe delivery mode, like in JMS. Maybe the point-to-point mode could be put on the long-term road map, but there is no rush. The current Errai bus works very well, thank you for all the good work!

             

            Cheers,

             

            V.