- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图了解确认模式在 JMS 中是如何工作的。我正在阅读这个来源,它让我非常困惑,因为它与 Spring 的文档所说的相矛盾。
消息人士说一件事:
来自 http://www.javaworld.com/article/2074123/java-web-development/transaction-and-redelivery-in-jms.html
A message is automatically acknowledged when it successfully returns from the receive() method. If the receiver uses the MessageListener interface, the message is automatically acknowledged when it successfully returns from the onMessage() method. If a failure occurs while executing the receive() method or the onMessage() method, the message is automatically redelivered.
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 listener container offers the following message acknowledgment options:
最佳答案
你错过了抽象容器 javadocs 中的关键短语......The exact behavior might vary according to the concrete listener container and JMS provider used.
Spring
中最常用的监听器容器是 DefaultMessageListenerContainer
其中 表现出这种行为 - 它旨在与事务(本地或外部事务管理器)一起使用,以便能够回滚已确认的消息。它的监听器被调用 后 接收方法,因此已经应用了标准的 JMS 自动确认。任意 JmsTemplate
线程上的操作也可以使用相同的 session ——因此可以是事务的一部分。
另一方面,SimpleMessageListenerContainer
使用传统 MessageListener
并表现出标准的 JMS 行为(在 Consumer
返回之前从 receive()
调用监听器;因此异常将停止 ack)。
我建议您阅读这些具体实现的 javadoc。来自 SMLC
...
This is the simplest form of a message listener container. It creates a fixed
number of JMS Sessions to invoke the listener, not allowing for dynamic
adaptation to runtime demands. Its main advantage is its low level of
complexity and the minimum requirements on the JMS provider: Not even the
ServerSessionPool facility is required.
See the AbstractMessageListenerContainer javadoc for details on acknowledge
modes and transaction options.
For a different style of MessageListener handling, through looped
MessageConsumer.receive() calls that also allow for transactional reception of
messages (registering them with XA transactions), see
DefaultMessageListenerContainer.
关于jms - 使用和不使用 Spring JMS 的 AUTO_ACKNOWLEDGEMENT 模式之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28426467/
我试过用谷歌搜索,但没有成功。如果我正在使用 AUTO_ACKNOWLEDGE,并且我有一个用 Java 编写的消费者客户端,那么消息何时被确认?我正在使用包含 onMessage 方法的 Messa
在下面的测试中,我试图模拟以下场景: 启动消息队列。 设计为在消息处理期间失败的使用者已启动。 产生一条消息。 消费者开始处理消息。 在处理过程中抛出异常以模拟消息处理失败。失败的消费者被停止。 另一
我有一个问题: 这是正确的吗,因为我在 java 文档中找不到相同的内容? 从这里开始JavaWorld 在 AUTO_ACKNOWLEDGMENT 模式下(非事务性) 如果执行receive()[s
我试图了解确认模式在 JMS 中是如何工作的。我正在阅读这个来源,它让我非常困惑,因为它与 Spring 的文档所说的相矛盾。 消息人士说一件事: 来自 http://www.javaworld.co
当在具有 AUTO_ACKNOWLEDGE 模式的 session 中调用 Message.acknowledge() 时,TIBCO 会发生什么情况? 我的意思是这个调用在客户端被忽略了吗?还是服务
我正在尝试使用 JMS 和 Spring 设置 SQS,但是当我尝试使用 AUTO_ACKNOWLEDGE 设置 session 确认模式时,会出现错误。我该怎么办? 当应用程序收到消息时,我需要删除
我是一名优秀的程序员,十分优秀!