I have a MDB configured to have 4 instances in the pool ready to serve incoming messages(maximun-mesages = 4 in container-configuration of jboss.xml). My MDB receives a message and goes to sleep for 2 minutes. scenario 1: If the MDB receives more than 4 messages the extra messages are rolled back. The extra messages continue to invoke the MDB until it becomes available. scenario 2: My problem is if I publish 4(or less) messages and then directly thereafter less than 4 messages. The first batch is consumed successfully. The second batch is rolledback (which is correct) and thereafter re-invoke the MDB but only for a finite amount of times. The second batch then disappears and only invoke the MDB after the container is shutdown and restarted. How can I get the second scenario to act like the first.
Secondly is it possible to allow the messages to remain in the queue until a MDB becomes available. In other words instead of my MDB rollingback messages until it is available, can the messages remain in the queue until there are zero active MDBs in the pool.
Any suggestions are appreciated.