How to handle Container Managed,Auto Acknowledge,

2019-09-05 10:20发布

I got a MDB - EJB 2.1, WebSphere 7 version

Container Managed and Auto Acknowledged

Transactions marked as Not Supported

Now how do I handle exceptions in a way that the message will be preserved during exception and redelivered later?

I tried to throw runtime exception from the catch block inside my MDB onMessage method. But that seems to stop the MDB Listener which is unexpected.

I cannot call context.setRollBackOnly() as there is no transaction.

1条回答
来,给爷笑一个
2楼-- · 2019-09-05 11:10

RuntimeException should be fine. Check this out Message-driven beans - transaction support. If your Listener stops, then you have probably Maximum retries set to 0. Set it to something higher.

查看更多
登录 后发表回答