3 Replies Latest reply on Oct 25, 2004 7:13 AM by schrouf

    Message Ordering

    nath

      hi friends,

      I am new to jms.I have a problem.

      I have multiple sender programs which sends messages to a Queue concurrently and have a single receiver program which receives messages from the queue. Sender1 sends 10 messages sender2 sends 10 messages etc. When I receive the messages from the Queue,message sent by different senders get mixed, like message1 of first sender then message 1 of second sender then message 2 of first sender etc.Is there any way to get all the message send by a single sender in a single session arrives in the Queue in a group?

      hoping for help,

      nath.

        • 1. Re: Message Ordering
          robisz

          Hi!

          I guess it's not possible.
          You can try to add a sender id to your messages and your
          receiver can sort out them by the id... but it's not exactly what you want.

          I recommend you use different queues for senders and your
          receiver can listen all of them.

          robisz

          • 2. Re: Message Ordering
            nath

            Robisz, thanks for your inputs. Shall I use a transacted session to solve the problem? Will JMS ensures that a messages sent from a transacted session to a Queue will always arrive in the Queue in a group

            • 3. Re: Message Ordering
              schrouf

              Transacted sessions will ensure that all or none (in case of failure) of your messages will be stored in the queue, but this does NOT mean, that there is a logical grouping between these messages which can be used for group based message processing on the client side !

              Read the JMS specification. You should not make any assumtions on message delivery order, as this would prohibit MDB scalebility ! Each message is treated as a independant logical unit of work.