ActiveMQ throttling consumer

馋奶兔 提交于 2019-12-01 19:53:04

this depends on the consumer technology being used...but here are a few options

  • you can manually introduce a delay in your consumer code (not an exact science but this will limit the throughput)

  • you can also control the number of threads that your consumer uses by setting maxConcurrentConsumers property of you JMS connection...that said, this won't throttle message throughput, just limit the level of concurrency being used by your consumer

  • better yet, you can set the exact number of messages to consume per time period using a throttler EIP implementation

    for example, this is trivial using the Camel Throttler

    from("activemq:queueA").throttle(10).to("activemq:queueB")

With ActiveMQ you can set the consumer prefetch limit: http://activemq.apache.org/what-is-the-prefetch-limit-for.html

To configure it, you can use the connection URL (most of the configurations can be done using the URL) or the Java API.

For more interesting parameters: http://activemq.apache.org/connection-configuration-uri.html

Vassilis

Take into account that Camel Throttler keeps the exchanges in-memory while they are blocked by the Throttler. So, if you have 100 queue consumers and the Server (exposing the SOAP service) is slow, you may have in-memory up to 100 exchanges!

Posted this question for this: Throttle consumption rate of all JMS consumers listening on an ActiveMQ queue

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