RabbitMQ: What is the default x-message-ttl value

核能气质少年 提交于 2019-11-29 17:09:34

问题


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.


回答1:


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

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 note:

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.

Per-message TTL note:

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.



来源:https://stackoverflow.com/questions/24946181/rabbitmq-what-is-the-default-x-message-ttl-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!