AMQ中Acknowledge那些事

应答模式和transaction的关系==>
0.Session.SESSION_TRANSACTED (0)
1.Session.AUTO_ACKNOWLEDGE (1)
2.Session.CLIENT_ACKNOWLEDGE (2)
3.Session.DUPS_OK_ACKNOWLEDGE (3)
4.EMQSession.INDIVIDUAL_ACKNOWLEDGE (4)
说明:SESSION_TRANSACTED是专门用作事务的应答模式的,非事务时,采用其他4种。
/////////////begin//////
1.AUTO_ACKNOWLEDGE With this acknowledgment mode, the session automatically acknowledges a client's receipt of a message either
when the session has successfully returned from a call to receive or when the message listener the session has
called to process the message successfully returns.
==>receive方法本身成功返回或者而onMessage时,是在成功处理消息返回,因为onMessage时,处理消息的过程在onMessage方法中完成。
2.DUPS_OK_ACKNOWLEDGE With this acknowledgment mode, the session automatically acknowledges a client's receipt of a message either
when the session has successfully returned from a call to receive or when the message listener the session has
called to process the message successfully returns. Acknowlegements may be delayed in this mode to increase
performance at the cost of the message being redelivered this client fails.
3.CLIENT_ACKNOWLEDGE With this acknowledgment mode, the client acknowledges a consumed message by calling the message's acknowledge method.
4.SESSION_TRANSACTED Messages will be consumed when the transaction commits.
/////////////end////////
AUTO_ACKNOWLEDGE和DUPS_OK_ACKNOWLEDGE的区别是【DUPS_OK_ACKNOWLEDGE】会出现重复应答,即当客户端失败时,redelivered消息会被分发到客户端,
而【AUTO_ACKNOWLEDGE】时,redelivered消息不会分发到客户端,即仅当mq server重启后才会分发到客户端;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值