Camel 运行时计时器更改 [英] Camel runtime timer change

查看:30
本文介绍了Camel 运行时计时器更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于骆驼和计时器的问题.我有几个计时器,其中一个我想在运行时更新.我正在使用 osgi 蓝图来配置适当的时间段.那么我怎样才能从路由中更改计时器(使用我知道的名字)?

I have a question about camel and timers. I have several timers and one of them I want update in runtime. I'm using osgi blueprint to configure proper periods. So how can I change timer(with name which I know) for example from route?

推荐答案

你可以在你的路由中添加一个实现 org.apache.camel.CamelContextAware 的 bean.Camel 将在启动时注入对上下文的引用.使用上下文,您可以获得计时器/石英端点的引用并更新其配置.

You can add a bean to your route that implements org.apache.camel.CamelContextAware. Camel will inject a reference to the context on start-up. Using the context you can get a reference of the timer/quartz endpoint and update its configuration.

我不知道这是否足以根据您的新周期/cron 表达式重新安排触发器.也许您必须将端点转换为 TimerEndpoint 并直接使用它,例如根据您的新计划设置新的 Timer 实例.

What I don't know is whether this will be enough for the triggers to be re-scheduled according to your new periods/cron-expression. Maybe you have to cast the endpoint to TimerEndpoint and work with it directly, e.g. setting a new Timer instance based on your new schedule.

这篇关于Camel 运行时计时器更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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