rabbitmq - RabbitMQ 是否保证已发布消息确认传送回客户端的顺序?

标签 rabbitmq rabbitmq-exchange

对于已发送 confirm.select 方法的发布者,RabbitMQ 代理的字面读取 documentation建议客户端收到消息确认响应的顺序可能与原始消息发布的顺序不同。

谁能证实情况确实如此?或者消息是否总是按照收到的顺序进行确认?如果可以以不同的顺序接收消息确认,那么需要什么条件才能实现这种情况?

最佳答案

Can anyone verify that this is indeed the case?

是的,消息可以按不同的顺序确认

What conditions are required for this to be the case?


The basic rules for confirm are as follows:

  • an un-routable mandatory or immediate message is confirmed right after the basic.return;
  • otherwise, a transient message is confirmed the moment it is enqueued;
  • a persistent message is confirmed when it is persisted to disk or when it is consumed on every queue.

所以,可能的原因可能是:

  1. 考虑持久性消息尚未持久化到磁盘而是转发给消费者的情况。由于消息是异步处理的,不同的消息可能会被消费者以不同的顺序确认,因此确认的顺序也会相应改变。
  2. TCP 问题。发布者发布的数据包不能保证以相同的顺序到达代理服务器。因此,发布者不能假设按照其发布的顺序接收它们。

关于rabbitmq - RabbitMQ 是否保证已发布消息确认传送回客户端的顺序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42679694/

相关文章:

rabbitmq - 使用 Autofac 进行总线配置 : Issue with RabbitMQ vs Loopback?

python - 允许 RabbitMQ 和 Pika 保持连接始终打开

c# - 重新排队后保持交货顺序

node.js - 为什么建立这么多连接?

php - 在 Windows 10 和 PHP 7.3 中安装 AMQP

java - 确保至少一个消费者收到在主题交换上发布的消息

RabbitMQ 死信交换 - 通过 "x-death.reason"或 "x-first-death-reason" header 路由

spring-boot - 多个带有 Spring Boot 的 Rabbitmq 队列

java - 某些尝试在同一台机器上连接到 RabbitMQ 会导致 TimeoutException

rabbitmq - 当我为rabbitmq-management创建用户时,发生了错误