我必须每天在不同的固定时间执行/运行相同的任务。时间间隔不一样。
例如,我想在 05:30、11:30、15:00、21:00 运行路由器。
我得到了很多带有调度程序 quartz 的 apache camel 示例。但都是静态时间间隔或只有一次可配置。
有没有办法在 apache camel 中配置?
最佳答案
尝试这样的事情:
<route>
<from uri="quartz2://timer1?cron=0+30+5+*+*+*">
<from uri="quartz2://timer2?cron=0+30+11+*+*+*">
<from uri="quartz2://timer3?cron=0+00+15+*+*+*">
<from uri="quartz2://timer4?cron=0+00+21+*+*+*">
<to uri="...">
</route>
今天在 quartz 组件中不可能提供自定义触发器,并且 quartz cron 触发器不支持您想要的东西。只需创建一个包含多个消费者的路由即可。
关于java - Apache Camel 每天安排多次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35585525/