Camel 运行时计时器更改

编程入门 行业动态 更新时间:2024-10-27 08:36:22
本文介绍了Camel 运行时计时器更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我有一个关于骆驼和计时器的问题.我有几个计时器,其中一个我想在运行时更新.我正在使用 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-19 22:43:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/971496.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时计   Camel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!