5 Replies Latest reply on May 7, 2007 5:12 PM by timfox

    Problem with JMS rollback

    keuller

      Hi folks,

      I am with a big problem in my solution. We're using JBoss Messaging to integrate many systems, we post text messages in a Queue. There are agent that consumes it messages from Queue and process towards persist in a database. If an error occurs during that process our agent abort the process and call rollbak() method in the QueueSession object.

      We're using persistent messages in Oracle database to guarantee post processing if any error occurs.

      The rollback operation is performed well and the messages continue stored in Oracle database.

      When we select JBM_MSG table all messages was failed are displayed to us. Our problem is how can we ativate that messages to be processed again ? There are many field in JBM_MSG which are fields enable this message to be processed again ?

      Anyone can help me ?

      Regards.

        • 1. Re: Problem with JMS rollback
          timfox

          Are you using MDBs or creating your own consumers directly on the queue?

          • 2. Re: Problem with JMS rollback
            keuller

            Hi Tim,

            I'm using consumers directly using JMS API.

            • 3. Re: Problem with JMS rollback
              timfox

              When you call rollback, any unacknowledged messages received in the current session will be redelivered automatically.

              If that sesion closes, then the messages will be put back on the queue and available to be consumed by other sessions.

              • 4. Re: Problem with JMS rollback
                keuller

                Tim,

                But my aplication has a time interval when we check Queue and each verification is a new session. If I apply rollback in a Session s1, according with you another software has created session s2 and it will be consumes the message again, thats right ?

                Or if I shutdown my application I'll close the current session and start again my application a new session will be created. So when a start again my application must be consumes all messages stored in table ?

                Regards.

                • 5. Re: Problem with JMS rollback
                  timfox

                   

                  "keuller" wrote:
                  Tim,

                  But my aplication has a time interval when we check Queue and each verification is a new session. If I apply rollback in a Session s1, according with you another software has created session s2 and it will be consumes the message again, thats right ?



                  According to the JMS spec rollback caues recovery of the session, so the messages will be immediately redelivered to the *same session* that called rollback. So after rollback they won't be available to be consumed by another session until the first session (the one that called rollback) closes.


                  Or if I shutdown my application I'll close the current session and start again my application a new session will be created. So when a start again my application must be consumes all messages stored in table ?

                  Regards.


                  Yes, if you close the session that called rollback and create a new one, then that new session should receive the messages again.