4 Replies Latest reply on Jul 5, 2004 6:03 AM by schrouf

    successive consume of messages

    nort

      Hello,

      I need to consume the JMS messages successivly. That means if I send 10 messages to the queue the onMessage-method has to be called and proceeded. After finishing the process of the first message the next message has to be consumed.

      The actual situation is, that for each message a instance is created and all messages were consumed on one time.

      Is this possible with such an Singleton MDB? How to set up it in 3.2.3 (specially in jboss.xml)? Would this solve my problem or knows someone a better way?

      Thanks,
      Juraj

        • 1. Re: successive consume of messages

          FAQ

          • 2. Re: successive consume of messages
            nort

            and the singleton MDB would solve my problem?

            • 3. Re: successive consume of messages

              I doubt it, if you don't know yourself.
              You know better than us what you are tring to achieve.

              An MDB is something that takes a single message and does something with it.
              Any correlation across multiple messages you have to write yourself.
              This includes any error recovery, e.g. what happens if messages
              7,8,9,10 never got sent

              • 4. Re: successive consume of messages
                schrouf

                MDB's are designed for asynchronous + decoupled + parallel message processing !!!

                If your special use case does not fit into this scenario DO NOT abuse MDB's for something they are not designed for ! Even for a singleton MDB there is no guarantee for ordered (re-)delivery of messages and - even more worse- your application will not scale at all !

                Rethink your application needs ! If you have to process multiple messages at once, put them all into one message instead of using separate messages. If this is not possible you might have to use a different application pattern (e.g. session\entity beans )