什么是“交付模式”?在 AMQP 中?

发布于 2024-08-23 06:49:54 字数 164 浏览 15 评论 0原文

我知道有两个选项可用:

  • “非持久”
  • “持久”

但这实际上意味着什么?

“非持久”:如果没有消费者,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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我还不会笑 2024-08-30 06:49:55

AMQP 中的delivery_mode 决定在代理重新启动后消息是否存储在磁盘上。您可以将消息标记为持久 - 通过在发布消息时设置 delivery_mode property = 2
例如在 PHP 中(PECL AMQP 扩展):

$exchange->publish($text, $routingKey, null, array('delivery_mode' => 2));

您还需要将队列声明为持久队列(或者在代理停止后它将被删除)

$queue->setFlags(AMQP_DURABLE);

delivery_mode in AMQP determines if message will be stored on disk after broker restarts. You can mark messages as persistent - by seting delivery_mode property = 2 when you publish message
for instance in PHP (PECL AMQP extension):

$exchange->publish($text, $routingKey, null, array('delivery_mode' => 2));

You would also need to declare queue as durable (or it will be dropped after broker stops)

$queue->setFlags(AMQP_DURABLE);
终止放荡 2024-08-30 06:49:55

传递模式的值将告诉 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).

相思故 2024-08-30 06:49:54

传递到“持久”队列的标记为“持久”的消息将记录到磁盘。如果发生崩溃,持久队列以及它们在崩溃之前存储的任何持久消息都会被恢复。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文