博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【原创】RabbitMQ 之 Queue Length Limit(翻译)
阅读量:6876 次
发布时间:2019-06-26

本文共 1501 字,大约阅读时间需要 5 分钟。

hot3.png

The maximum length of a queue can be limited to a set number of messages by supplying the x-max-lengthqueue declaration argument with a non-negative integer value. Queue length is a measure that takes into account ready messages, ignoring unacknowledged messages and message size. Messages will be dropped or dead-lettered from the front of the queue to make room for new messages once the limit is reached.

一个 queue 中消息最大保存量可以在声明 queue 的时候通过设置 x-max-length 参数为非负整数进行指定。Queue 长度的选取需要考量 就绪消息量、被忽略的未确认消息量,以及消息大小。当 queue 中的消息量达到了设定的上限时,为了给新消息腾出空间,将会从该 queue 用于保存消息的队列的前端将“老”消息丢弃或者 dead-lettered 

This example in Java declares a queue with a maximum length of 10 messages:

下面的 Java 示例展示了如何声明一个最多保存 10 条消息的 queue :

Map
args = new HashMap
();args.put("x-max-length", 10);channel.queueDeclare("myqueue", false, false, false, args);
Configuration using policy
To specify a maximum length using policy, add the key "max-length" to a policy definition. For example:
通过 policy 对 queue 的最大长度进行设置,例如可以在 policy 的定义中使用 key “max-length”:
rabbitmqctl
rabbitmqctl set_policy Ten "^short$" '{"max-length":10}' --apply-to queues
rabbitmqctl (Windows)
rabbitmqctl set_policy Ten "^short$" "{""max-length"":10}" --apply-to queues
This applies a maximum length of 10 to the queue called short.
这使得名字叫 short 的 queue 的最大消息保存量被限制在 10 。
Policies can also be defined using the management plugin, s
ee the for mo
re details.
同样可以使用管理插件来指定 policy ,参见 
 。

转载于:https://my.oschina.net/moooofly/blog/142128

你可能感兴趣的文章
如何对待用户需求的几点思考
查看>>
团队进展报告(3)
查看>>
沈阳市房地产市场信息系统数据容灾与异地备份
查看>>
nlp Task2
查看>>
我的友情链接
查看>>
简单干净的C#方法设计案例:SFCUI.AjaxLoadPage()之一
查看>>
XMPP协议的原理介绍
查看>>
Undo管理
查看>>
jsp简易留言板
查看>>
3.15好水指数N1能否让饮水健康不失控?
查看>>
Linux防火墙的设置
查看>>
人人商城PHP网站打开网页空白
查看>>
redhat修改源
查看>>
ruby 访问权限
查看>>
linux磁盘管理命令--df
查看>>
cocos2d: 单击,双击,及双指捏合事件的判断
查看>>
读书笔记《unix系统编程》-第2章 文件
查看>>
统一日志平台-搭建
查看>>
项目经理,不要迷信制度!
查看>>
NDK如何集成libiconv
查看>>