Java:关于JMS中的Session.AUTO_ACKNOWLEDGE常量
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java:关于JMS中的Session.AUTO_ACKNOWLEDGE常量相关的知识,希望对你有一定的参考价值。
JMS有以下通信流程:
【消息生产者】——【JMS Provider】——【消息消费者】
那么Session.AUTO_ACKNOWLEDGE指的是【JMS Provider】向【消息生产者】发送确认信息表示已经收到消息了,还是【消息消费者】向【JMS Provider】发送确认信息呢表示已经收到消息了?
CLIENT_ACKNOWLEDGE With AUTO_ACKNOWLEDGE mode the acknowledgment is always the last thing to happen implicitly after the onMessage() handler returns. The client receiving the messages can get finer-grained control over the delivery of guaranteed messages by specifying the CLIENT_ACKNOWLEDGE mode on the consuming session.
The use of CLIENT_ACKNOWLEDGE allows the application to control when the acknowledgment is sent. For example, an application can acknowledge a message - thereby relieving the JMS provider of its duty - and perform further processing of the data represented by the message. The key to this is the acknowledge() method on the Message object, as shown in Listing 1.
The acknowledge() method informs the JMS provider that the message has been successfully received by the consumer. This method throws an exception to the client if a provider failure occurs during the acknowledgment process. The provider failure results in the message being retained by the JMS server for redelivery.
If you agree with me ,请采纳一下
以上是关于Java:关于JMS中的Session.AUTO_ACKNOWLEDGE常量的主要内容,如果未能解决你的问题,请参考以下文章