什么是“交付模式”?在 AMQP 中?
我知道有两个选项可用:
- “非持久”
- “持久”
但这实际上意味着什么?
“非持久”:如果没有消费者,AMQP 结构将尝试传递消息,消息会被丢弃吗?
“持久”如:AMQP 将重试消息,直到消费者接受它?
I understand that 2 options are available:
- "Non-persistent"
- "Persistent"
But what does this actually mean?
"Non-persistent" as in : the AMQP fabric will try to deliver the message if there are no consumers, the message will be dropped?
"Persistent" as in : AMQP will retry the message until a consumer accepts it??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
AMQP 中的delivery_mode 决定在代理重新启动后消息是否存储在磁盘上。您可以将消息标记为持久 - 通过在发布消息时设置
delivery_mode property = 2
例如在 PHP 中(PECL AMQP 扩展):
您还需要将队列声明为持久队列(或者在代理停止后它将被删除)
delivery_mode
in AMQP determines if message will be stored on disk after broker restarts. You can mark messages as persistent - by setingdelivery_mode property = 2
when you publish messagefor instance in PHP (PECL AMQP extension):
You would also need to declare queue as durable (or it will be dropped after broker stops)
传递模式的值将告诉 RabbitMQ 当消息放入队列时是否允许将消息保留在内存中(非持久),或者是否必须首先将消息存储在磁盘上(持久)。
The value of the delivery mode will tell RabbitMQ if it’s allowed to keep the message in memory when the message is placed in a queue (non-persistent) or if it must store the message on disk first (persistent).
传递到“持久”队列的标记为“持久”的消息将记录到磁盘。如果发生崩溃,持久队列以及它们在崩溃之前存储的任何持久消息都会被恢复。
Messages marked as 'persistent' that are delivered to 'durable' queues will be logged to disk. Durable queues are recovered in the event of a crash, along with any persistent messages they stored prior to the crash.