RabbitMQ basic.return

RabbitMQ basic.return

如果我发布时带有确认(model.ConfirmSelect)又名 basic.ack 和强制标记。如果消息未送达,我是否总是会在 basic.ack 事件之前收到 basic.return 事件。

我想将所有 basic.return 消息添加到 ConcurrentDictionary 并在发布后检查消息是否在词典中 我将抛出一个异常,即不存在 queue/route,然后删除它,错误或成功。

是的,您将始终按此顺序收到活动。

来自documentation

When will messages be confirmed?

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).