限制侦听 ActiveMQ 队列的所有 JMS 使用者的消耗率 [英] Throttle consumption rate of all JMS consumers listening on an ActiveMQ queue

查看:28
本文介绍了限制侦听 ActiveMQ 队列的所有 JMS 使用者的消耗率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Camel Throttler 组件,您可以定义每个时间段消耗消息的速率上限,例如:

Using Camel Throttler component you can define an upper limit on the rate of consumed messages per time period, e.g.:

from("activemq:queueA").throttle(10).to("direct-vm:bla")

我认为不理想的是,Camel Throttler 将交换保留在内存中,而它们被 Throttler 阻止.因此,如果您有 100 个队列使用者,并且由于任何原因direct-vm:bla"很慢(例如调用外部慢速服务),您可能在内存中最多有 100 个交换!

What I see as non ideal is that Camel Throttler keeps the exchanges in-memory while they are blocked by the Throttler. So, if you have 100 queue consumers and for any reason the "direct-vm:bla" is slow (e.g. invoking external slow service), you may have in-memory up to 100 exchanges!

我想知道是否有 ActiveMQ 功能可以在 ActiveMQ 级别上强加节流要求.甚至可能在每个队列级别上.类似于 HornetQ 的 consumer-max-rate.

I was wondering if there is an ActiveMQ feature to impose the throttling requirement on the ActiveMQ level. Maybe even on a per queue level. Something similar to consumer-max-rate of HornetQ.

推荐答案

配置使用者以使用事务(不必是 XA 事务.如果您只有 1 个其他端点,请使用本地 JMS 事务.请参阅:LLR 交易方法).如果 Camel 路由失败,消息将回滚到代理.

Configure the consumer to use a transaction (doesn't have to be an XA transaction. If you only have 1 other endpoint use a local JMS transaction. see: LLR transaction approach). If the Camel route fails, the messages roll back to the broker.

这篇关于限制侦听 ActiveMQ 队列的所有 JMS 使用者的消耗率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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