rabbitmq confirm机制路由不到队列无法触发handleNack

 

以下是官网原话

https://www.rabbitmq.com/confirms.html#when-publishes-are-confirmed

When Will Published Messages Be Confirmed by the Broker?

For unroutable messages, the broker will issue a confirm once the exchange verifies a message won't route to any queue (returns an empty list of queues). If the message is also published as mandatory, the basic.return is sent to the client before basic.ack. The same is true for negative acknowledgements (basic.nack).

For routable messages, the basic.ack is sent when a message has been accepted by all the queues. For persistent messages routed to durable queues, this means persisting to disk. For mirrored queues, this means that all mirrors have accepted the message.

 

大意是说 消息只要进入交换器 就会发送 Ack  但是当消息无法路由到队列时  会在发送basic.ack 之前 发送一条basic.return 命令

所以 rabbitmq的confirm 模式 只是保证了消息进入了rabbitmq 并且被处理,这个被处理 不一定保证进入队列,还有可能被返回(设置了mandatory的时候)。只要交换器是存在的,在进入confirm模式后 就一定是返回Ack的 除非交换器不存在  才会返回Nack

 

我看 rabbitmq 实战指南说的是 保证进入队列 今天脑子一热试了下 结果怎么都是 ack 除非交换器不存在 一看官网,才知道到现在的版本 已经变成这样了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值