5 Replies Latest reply on Aug 31, 2010 11:51 AM by Clebert Suconic

    Is it possible to keep a message in a queue until it is consumed by an MDB?

    Swapnonil Mukherjee Newbie

      Hi Everybody,

       

      I am using HornetQ 2.0 GA with JBoss 5.1GA. I am sending messages from a Stateless Session Bean and consuming them using a Message Driven Bean. I have set up a master/slave topology where the both the master and slave share the same storage for all queues.

       

      What I want to do is to keep a message in a queue until the MDB which has been allotted this message says that it has completely finished processing it.

       

      The sequene should be like this

       

      In normal course of operation

      1. Client sends a message to a queue
      2. HornetQ picks up the message from the qeue and delivers it to a new instance of an MDB, but the message is not taken off the queue.
      3. The MDB finishes processing of the message.
      4. The message is finally taken off the queue.

       

      In case the MDB encounters an exception, or the server running executing the MDB shuts down.

      1. Client sends a message to a queue
      2. HornetQ picks up the message from the qeue and delivers it to a new instance of an MDB, but the message is not taken off the queue.
      3. Master shuts down
      4. The message is not taken off the queue and it remains there, as the MDB instance at the Master which had consumed this message server could not finsih it's job.
      5. HornetQ picks up the message again and delivers it to the next available MDB on the Slave.

       

      So by using a shared queue, and by not taking messages off the queue until they are fully consumed, I think I can achieve full DR.

       

      Therefore my question is: Is it possible to keep a message in a queue until it is consumed by an MDB?