JMS message redelivery on exception in JMS listener

梦想的初衷 提交于 2019-12-01 06:29:06

It depends on which listener container you use; when using AUTO ack mode, the SimpleMessageListenerContainer acks after the listener returns (i.e. a traditional JMS MessageListener). The DefaultMessageListenerContainer acks before the listener is invoked, so you need acknowledgeMode="transacted" to prevent message loss.

The javadocs in this area were a bit misleading and have been improved recently.

With CLIENT_ACKNOWLEDGE, you're on your own to do the acks. That doc just means you are at the whim of the broker. According to the JMS message javadoc:

Messages that have been received but not acknowledged may be redelivered

In my experience it is best to use auto ack with an SMLC and transactions with DMLC.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!