7 Replies Latest reply on May 15, 2008 7:46 AM by Rienk van der Ploeg

    getting messages by the order they were sent

    Subrata Saha Newbie

      Hi ,
      Can any body please help me in my problem...

      I am running producer to send 10000 message in the queue and consumer is not running , so the data get saved in to the mysql data base i configured.and
      i stopped the producer.

      Now again i start producing data and in the mean time i started consumer again, what i observed that my consumer is getting recent data produced
      , not the data which is persisted (i.e not following the order)

      so if i want to get the data of some particular time interval when my consumer
      was not active, and starting the consumer now i am getting the recent data
      which creating problem for me.

      Any advice will be greatly appreciated.
      (Where as in Apache ActiveMQ does that)

        • 1. Re: getting messages by the order they were sent
          Tim Fox Master

          If you create a non durable subscriber it will only receive messages that are sent while that subscriber exists. That is *as per JMS spec*.

          If you want to receive messages that were sent while the subscriber is not is connected, you need to use a durable subscriber.

          Again, I would suggest reading the JMS spec for an understanding of the differences between durable and non durable subscribers.

          • 2. Re: getting messages by the order they were sent
            Subrata Saha Newbie

            Thanks Tim,
            I am using point to point model.
            So i am using queue (there is no durable subscriber)

            If we use Topic also for Durable then its same as Queue with persistance.
            So when my consumer is down it is getting saved in the database and the next time i am starting my consumer , i am able to get those messages.

            but my problem was the order as i mentioned.

            Durability ensures that you will lose messages.

            Or you want to say if we use durable topic subscriber,
            -> produce the 10,000 message when consumer is not running.
            -> stop the producer.
            -> now start the consumer and producer at the same time.
            -> and i will get previous message first then the messages which
            being produced by the recent producer. (and thus ensuring the older
            messages are coming first. )

            • 3. Re: getting messages by the order they were sent
              Tim Fox Master

              I am failing to understand what this thread is about.

              JBM fully supports all ordering semantics as defined in the JMS spec.

              • 4. Re: getting messages by the order they were sent
                Subrata Saha Newbie

                -->My producer is sending Message M1,M2,M3 to a queue /queue/q1
                -->no consumer is running that time, so i see M1,M2,M3 in mysql data base.
                --> I started my producer to send messages M4,M5,M6 and at the same
                time i started my consumer too.
                --> So in the consumer i see the messages M4,M5,M6 first followed by M1,M2,M3(that means it is taking the messages from the memory first rather than persistent data base)
                --> is there any mechanism that ensures that i get M1,M2,M3,M4,M5 then M6
                (i.e. old message first)

                • 5. Re: getting messages by the order they were sent
                  Tim Fox Master

                  That should certainly never happen.

                  JBM will (as per JMS spec) always deliver messages in the order they were sent from a particular producer.

                  Please post a simple test case demonstrating the issue. Also please mention what version of JBM you are using.

                  • 6. Re: getting messages by the order they were sent
                    Subrata Saha Newbie

                    Thanks Tim
                    It seems it was confusion created for few people using the same queue.
                    So "Messages are coming in Order Only according to JMS spec"

                    I have done a comparative study of JBM and ActiveMQ for past two month.
                    And The Result is JBM Rocks..

                    We will use JBM for our project now.
                    Thanks,
                    Subrata

                    • 7. Re: getting messages by the order they were sent
                      Rienk van der Ploeg Newbie

                      Getting curious: You did a comparative study of JBM and ActiveMQ. I'm doing the same exercise right now, would you be so kind to share your results with other people like me?