RabbitMQ:默认的 x-message-ttl 值是多少 [英] RabbitMQ: What is the default x-message-ttl value

查看:132
本文介绍了RabbitMQ:默认的 x-message-ttl 值是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 RabbitMQ 文档中找不到安装时附带的默认 x-message-ttl 值.

I couldn't find in RabbitMQ documentation the default x-message-ttl value comes with the installation.

我知道如何将其设置为所需的值,但我很想知道默认值.

I know how to set it to a desired value but I am curious to know the default value.

推荐答案

broker 端默认没有设置 x-message-ttl 参数,所以基本上你可以将默认值解释为无穷大.

There are no x-message-ttl argument set by default from the broker side, so basically you can interpret default value as infinity.

如果您将没有 ttl 的消息发布到没有设置 ttl 的队列(是的,有每个消息和每个队列的 ttl 参数,请参见下面的注释):

If you publish message without ttl to queue without ttl set (yupp, there are per-message and per-queue ttl arguments, see note below):

  • 如果消息发布为持久化且队列声明为持久化消息,只要不被消费,就会一直留在队列中;

  • if message published as persistent and queue declared as persistent message will stay in queue as long as it will not be consumed;

如果消息未发布为持久性或队列未声明为持久性,则消息将一直保留在队列中,只要它不会被消费或直到代理重新启动.

if message was not published as persistent or queue was not declared as persistent, then message will stay in queue as long as it will not be consumed or until broker restart.

TTL 注意:

当 per-message 和 per-queue ttl set broker 使用最小值时.例如,如果每条消息的 ttl 为 10000(10 秒),每条队列的 ttl 为 20000(20 秒),则将应用每条消息的 ttl.

When both per-message and per-queue ttl set broker use the minimal vale. For example, if per-message ttl is 10000 (10 sec) and per-queue ttl is 20000 (20 sec) then per-message ttl will applied.

每条消息的 TTL 注释:

Per-message TTL note:

ttl 过期的消息只要没有到达队列头,就会留在队列中.别担心,它们不会发送给消费者,但它们会占用一些资源,直到它们到达头部.这就是 RabbitMQ 队列的工作原理(他们坚持 FIFO 的想法,这有时可能会破坏与 AMQP 协议的严格兼容性).请参阅生存时间扩展中的警告部分了解更多信息.

Messages with expired ttl will stay in queue as long as they not reached queue head. Don't worry, they will not be send to consumer, but they will take some resources until they reach head. This is how RabbitMQ queues works (they stick to FIFO idea, which is sometimes may break strict compatibility with AMQP protocol). See Caveats section in Time-To-Live Extensions for more.

这篇关于RabbitMQ:默认的 x-message-ttl 值是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆