7 Replies Latest reply on Aug 19, 2002 3:20 PM by rboston

    ordering of messages

    alan shields Newbie

      I have two messages that get sent very close together.

      My MDB gets called with the messages in the right order, however the second message is called before the first message is complete.

      Unfortunately I need the first message to complete before message 2 is called.

      Can I force the container to only maintain one instance of this MDB?

      Alternatively will changing the priority help me? do higher priority messages complete before lower priority ones are called or does it just mean they get to the top of the queue faster?

      Thanks

        • 1. Re: ordering of messages
          Hiram Chirino Expert

          Search this forum.. this has been discussed before.

          • 2. Re: ordering of messages
            alan shields Newbie

            Do you mean :

            http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ way of fixing this problem is to reduce the max >>number of session the MDB uses to 1.
            >>
            >>Regards,
            >>Hiram

            Sorry, I'm having trouble finding out how to do that, or is the answer that I shouldn't be trying to do something like this with an MDB?

            Thanks

            • 3. Re: ordering of messages
              Daniel Johnsun Newbie

              Finally resolved the same problem myself.

              Have a look at the "Standard Message Driven Bean" config in standardjboss.xml. You have to set <container-invoker-conf> to 1. What you can do is copy this container config into your jboss.xml. Change the config name and maximum size to 1. And for any MDBs that require ordering change the configuration name to point to your new config.

              Regards,
              Dan

              • 4. Re: ordering of messages
                Andreas Schaefer Apprentice

                Hi

                I don't like this trick. The problem is that it only works when the JBoss configuration is set correctly because JMS spec. does not guarantee any order.

                So I would change my MDB do deal with the problem instead of using a tricky workaround. A solution would be to store the 'out of order' messages in a DB (Hypersonic) and check when the first message is coming in if the second not already came in. This would enable your MDB to scale and work in any configuration.

                Have fun - Andy

                • 5. Re: ordering of messages
                  Chad Stone Newbie

                  I am getting mesage ordering problems with a queue, EVEN WHEN NOT USING A MDB! If I use a simple JMS client program to send and receive messages via a queue, often the first few messages get switched order. This looks like a JBoss bug.

                  NOTE: Using JBoss 3.0.0 on Red Hat Linux.
                  NOTE: Same JBoss on Win2000 has not exhibited this issue.

                  I am cleanly closing the queue connection after the sends.

                  The test programs are attached for reference.

                  • 6. Re: ordering of messages
                    rboston Newbie

                    How many producers and consumers do you have??

                    I've got an app that has one consumer per producer and my messages through a queue are in order.
                    The only time I saw a problem I learned was my error with a selector and there was more than one consumer and the selector was NOT properly setup.

                    • 7. Re: ordering of messages
                      rboston Newbie

                      How many producers and consumers do you have??

                      I've got an app that has one consumer per producer and my messages through a queue are in order.
                      The only time I saw a problem I learned was my error with a selector and there was more than one consumer and the selector was NOT properly setup.