更新时间:2023-01-18 20:26:39
您必须使用 DMLC 的事务.
You have to use transactions with the DMLC.
使用 Session.AUTO_ACKNOWLEDGE
和 setSessionTransacted(true)
.
如果监听器正常退出,则消息被移除.如果侦听器抛出异常,消息将回滚到队列中.
If the listener exits normally, the message is removed. If the listener throws an exception, the message will be rolled-back onto the queue.
您也可以对交易使用客户端模式,但您必须自己确认成功的消息.
You can also use client mode with transactions, but you have to acknowledge successful messages yourself.
您不必使用带有 SimpleMessageListenerContainer
的事务,但您仍然必须抛出异常才能将消息重新排队.
You don't have to use transactions with a SimpleMessageListenerContainer
but you still have to throw an exception to get the message requeued.