骆驼运行时计时器更改 [英] Camel runtime timer change
问题描述
我有一个关于骆驼和计时器的问题.我有几个计时器,其中一个我想在运行时更新.我正在使用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.骆驼将在启动时注入对上下文的引用.使用上下文,您可以获取计时器/石英端点的引用并更新其配置.
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.
这篇关于骆驼运行时计时器更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!