-
1. Re: NonXA Rollback consumes message
gavinandrews Aug 29, 2003 5:34 AM (in response to gavinandrews)Well I read Chapter 15 of the EJB 2.0 spec and found "clients should not throw RuntimeException" in onMessage....
and I read Section 4.5.2 in the JMS Spec and it said "RuntimeException is considered a client programming error"...
so I guess I need a new approach...
Is there a good way to determine that the Transaction will be rolled back and forward the message to the DLQ before returning (without exception) from the MDB onMessage?
A Snippet would be appreciated if someone else is already doing this.
Thanks,
Gavin -
2. Re: NonXA Rollback consumes message
adrian.brock Aug 29, 2003 7:25 AM (in response to gavinandrews)MessageDrivenContext ctx;
public void setMessageDrivenContext(MessageDrivenContext ctx)
{
this.ctx = ctx();
}
public void onMessage(Message message)
{
try
{
handleMessage(message);
}
catch (Throwable t)
{
ctx.setRollbackOnly();
reportError(t);
}
Regards,
Adrian