Camel Quartz route undesired job execution at route startup

你离开我真会死。 提交于 2019-12-12 14:01:58

问题


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:

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:

  • I start my route at day1 before 17:00, the job will be triggered day1 at 17:00
  • I start my route at day1 after 17:00, the job should be triggered day2 at 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.


回答1:


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

EDIT: Based on soilworker's comment, the above should be:

trigger.misfireInstruction=2



来源:https://stackoverflow.com/questions/19241529/camel-quartz-route-undesired-job-execution-at-route-startup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!