3 Replies Latest reply on Apr 11, 2002 2:38 AM by pra

    Dropping Messages until server restart

    jtew

      I've been testing out the JbossMQ code base from CVS as of about a week ago and have encountered the following scenario.

      I've written a JMS client that is listening to a queue. The session is trasacted with AUTO_ACKNOWLEDGEMENT set. When I receive a message if I call session.rollback() the message is redelivered again as I would expect. If I call session.commit() the message is removed from the queue as I would expect. The problem arises when the JVM die or is killed before commit() or rollback() is called. The queue shows a depth of zero and the message is not redelivered. I can tell the message is still in the queue because the file associated with it is still on the disk. When I restart the server then queue depth will read 1 and the message will get delivered to the client.

      It would seem to me that JBossMQ should detect that the client died without committing the transaction and return the message to the queue immediately for another JMS client to handle. Am I missing something in this picture?

      Thanks,
      Jonathan

        • 1. Re: Dropping Messages until server restart

          When you set AUTO_ACK you can not control the transaction your self. This is done automatically.

          //Peter

          • 2. Re: Dropping Messages until server restart
            jtew

            No, that wasn't the problem. The problem clearly exists in the JBossMQ code and the way it handles a client disconnecting. Same exact code functions exactly as you would expect under IBM's MQSeries. I sincerely hope that the JBossMQ development team focuses a lot on clients outside of the JVM as opposed to just MDBs inside the JVM.

            Jonathan

            • 3. Re: Dropping Messages until server restart

              Hey, are you using a transacted session OR ackmode. Using both is not relevant. From TopicConnection.createTopicSession:

              transacted - if true, the session is transacted.
              acknowledgeMode - indicates whether the consumer or the client will acknowledge any messages it receives. This parameter will be ignored if the session is transacted.


              Have you created your session with transacted set to true?

              //Peter