I have a doubt on MDBs...If an application exception is caught on the onMessage method of a MDB and I found that it is not possible to continue there after....So in the catch block I call ctx.setRollbackOnly() and re-throw the exception. Now what will happen?...Will the container try to deliver the message again to some other instance from the same pool or will the container simply discard the instance and discard the message?.
Well, if you use ctx.setRollbackOnly() I guess you are using CMT. With CMT the Message will be redelievered again and again and again... That happens because the whole transaction (including the receipt of the message from the Queue) ist rolled back what means that the message is put back on the Queue.
[ October 10, 2005: Message edited by: Frank Ertl ] [ October 10, 2005: Message edited by: Frank Ertl ]
If you use CMT the bean instance will be discarded and the transaction will be rolled back unless you specify the transaction attribute to "NotSupported". With bean managed persistence the bean instance will be discarded, too, but what happens to the message depends on your acknowlegement policy ("auto-acknowledge" vs. "dups-ok-acknowledge").
You firghten me terribly. I would like to go home now. Here, take this tiny ad: