基于时间间隔的节流 [英] Throttling based on time interval

查看:28
本文介绍了基于时间间隔的节流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 ActiveMQ 中有 4 个队列,每个队列中的消息应该发送到外部服务,以便从队列中获取消息,我正在使用 Apache Camel 并且正在限制消息.
但我的问题是对于不同的队列,我有不同的社交时间.例如
队列 1 消息应仅在上午 6 点至下午 5 点之间发送,
队列 2 消息应该只在上午 10 点到晚上 10 点之间发送.

I have 4 queues in ActiveMQ and messages from each queue should be sent out to external service, for picking up the messages from queue I am using Apache Camel and I am throttling the messages.
But my problem here is for different queues I have different social hours. For e.g.
Queue 1 messages should be sent only between 6 AM to 5 PM,
Queue 2 messages should be sent only between 10 AM to 10 PM like that.

所以我想知道我们如何使用 Apache 骆驼节流来处理这个问题.或者请给我建议一些解决方案.

So I want to know how can we handle this using Apache camel throttling. Or please suggest me some solution.

如果有人没有解决我的问题,请告诉我.提前致谢.

Let me know if anyone not cleared with my problem. Thanks in advance.

推荐答案

Camel 允许您将路由与路由策略相关联.我们有一个开箱即用的政策,该政策基于骆驼石英并基于计划.这允许您为路线的营业时间设置政策.

Camel allows you to associate route(s) with route policies. And we have an out of the box policy that is based on camel-quartz and is scheduled based. This allows you to setup policies for opening hours of your routes.

文档从这里开始:http://camel.apache.org/routepolicy.并且有从该页面到基于调度程序的策略的链接.

The doc starts here: http://camel.apache.org/routepolicy. And there is links from that page to the the scheduler based policies.

介意有一张票 - http://issues.apache.org/jira/浏览/CAMEL-5929 - 关于如果您重新启动应用程序服务器,那么如果您在开放时间内开始,则该路线不会开始.例如你有 12 点到 6 点.然后您在下午 3 点重新启动应用程序(例如中间).然后我第二天开始的路线.如果在打开的窗口内启动,则可以使用该票证进行配置以强制启动.

Mind there is a ticket - http://issues.apache.org/jira/browse/CAMEL-5929 - about if you restart the app server, then the route is not started if you start within the opening hours. eg your have 12pm-6pm. And you restart the app at 3pm (eg in between). Then the route i started on the next day. The ticket is there to allow you to configure to force start if being started within the opening window.

这篇关于基于时间间隔的节流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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