java 如何为activemq设置队列最大长度

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11302265/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 04:35:36  来源:igfitidea点击:

How to set queue max length for activemq

javaqueueactivemqconfigure

提问by WarriorOfKnight

I'm wondering if I can configure a queue's max length on activemq, so that when the queue's length touch the limit, the enqueue operation will failed or throw exceptions. is anybody know about this question? any help will be very appreciated.

我想知道是否可以在activemq上配置队列的最大长度,以便当队列长度达到限制时,入队操作将失败或抛出异常。有人知道这个问题吗?任何帮助将不胜感激。

Thanks a lot.

非常感谢。

回答by Tim Bish

Take a look at Producer Flow Control http://activemq.apache.org/producer-flow-control.html

看看生产者流控制http://activemq.apache.org/producer-flow-control.html

It limits your queue on the amount of memory the queue takes so its not a numbers of messages approach but a memory sizing approach. You can have an exception thrown back to the client when the broker reaches its max resources limit.

它限制了队列占用的内存量,因此它不是消息数量方法,而是内存大小调整方法。当代理达到其最大资源限制时,您可以向客户端抛出异常。