如何防止Java MDB暂停IBM Websphere WAS 8.5上的错误?

时间:2015-09-23 12:40:09

标签: java-ee ibm-mq websphere-8 ibm-was

抛出异常后,我们的Java MDB应用程序的MQ消息端点正在暂停消息

CWWMQ0007W: The message endpoint <APP> has been paused by the system.  Message delivery failed to the endpoint more than <N> times.

据我所知,这符合每个应用程序规范,并且这种行为对于许多应用程序来说都是合理的。

在我们的例子中,我们希望从队列中消耗导致异常的MQ消息,并且应用程序仍在运行,即。处理下一条消息。

除了在MDB onMessage方法中捕获任何Throwable之外,有没有办法实现这种方式?

1 个答案:

答案 0 :(得分:3)

阅读本文How WebSphere Application Server V8.x handles poison messages,它描述了各种场景。

如果您想在不停止端点的情况下继续处理,请取消选中Stop endpoint if message delivery fails或将Number of sequential delivery failures before suspending endpoint设置为激活规范配置中的某个更高值。您还必须在WebSphere MQ中配置Backout threshold (BOTHRESH)属性。

这样,MQ会将异常消息放入DEAD.LETTER.QUEUE,并允许您处理下一条消息。