Spring DMLC 消息消耗:auto_ack vs Transacted Session [英] Spring DMLC message consumption: auto_ack vs Transacted Session

查看:21
本文介绍了Spring DMLC 消息消耗:auto_ack vs Transacted Session的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个关于 Spring DMLC 的问题.

I have couple of questions regarding spring DMLC.

  1. 为什么 Spring 供应商建议将 DMLC(默认消息侦听器容器)与事务一起使用?

Spring DLMC 和 JMSTemplate 在使用事务时的行为

  1. 在消费者方面,如果我使用带有 sessionTransacted=false 的 DMLC,它将默认使用 ACTO_ACK 模式.这两种情况(事务和 AUTO_ACK)之间有什么区别?根据我的理解,在这两种情况下,确认过程看起来都与我相似:

Transacted:消费者收到消息后,将立即向代理发送提交,然后只有代理将消息视为已交付.

Transacted: As soon as message is received by the consumer, a commit will be send to broker and thn only broker will consider message as delivered.

Auto_Ack:这里对于消费者收到的每条消息,消费者都会向代理发送确认.

Auto_Ack: Here also for each message received by the consumer, a acknowledgement will be send to the broker by consumer.

如果我错了,请纠正我.

Please correct me if I am wrong.

谢谢,

阿努杰

推荐答案

使用 DMLC 和自动确认,消息一收到就会被确认(并且在调用侦听器之前).

With the DMLC and auto ack, the message is acked as soon as it is received (and before the listener is called).

事务处理后,会话在监听器被调用之后提交;并且,如果侦听器抛出异常(或系统断电),则事务将回滚(消息重新排队).

With transacted, the session is committed after the listener is called; and, if the listener throws an exception (or the system loses power), the transaction is rolled back (message requeued).

这篇关于Spring DMLC 消息消耗:auto_ack vs Transacted Session的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆