问题描述
我有几条路线看起来像:
I have several routes that looks like :
from("quartz://" + getJobId() + "?cron=" + cronExpression + "&stateful=true")
.routeId(getJobId())
.autoStartup(false)
.to(getRouteTo());
可以从管理控制台启动和停止这些路由.我遇到的问题如下:
Those routes can be started and stopped from an administration console.The problem I have is the following:
如果路由配置为每天 17:00 运行,当前如果我的路由在 17:00 之后启动,石英注意到它应该在 17:00 运行,并将尝试恢复错过的执行.
If a route is configured to run everyday at 17:00, currently if my route is started after 17:00,quartz notice that it should have run at 17:00 and will try to recover that missed execution.
我不希望这种情况发生,我想要的:
I don't want that to happen, what I want:
- 我在第 1 天 17:00 之前开始我的路线,作业将在第 1 天 17:00 触发
- 我在第 1 天 17:00 之后开始我的路线,作业应该在第 2 天 17:00 触发
这与我选择了一份有状态的工作有关吗?我选择了一个有状态的作业来避免同一作业的并发执行.
Is it related to the fact that I chose a statefull job ?I chose a stateful job to avoid concurrent execution of the same job.
推荐答案
根据 Claus 的建议,也许以下内容可以用作石英作业的参数(假设您使用的是 org.quartz.SimpleTrigger):
Based on Claus's suggestion, perhaps the following would work as a parameter on the quartz job (assuming you're using a org.quartz.SimpleTrigger):
trigger.misfireInstruction=org.quartz.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT
trigger.misfireInstruction=org.quartz.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT
根据soilworker的评论,以上应该是:
trigger.misfireInstruction=2
这篇关于Camel Quartz 在路由启动时路由不需要的作业执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!