[
https://issues.apache.org/jira/browse/CAMEL-11632?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Viktor Khoroshko updated CAMEL-11632:
-------------------------------------
Summary: QuartzScheduledPollConsumerScheduler causes trigger misfires on
each application start (was: QuartzScheduledPollConsumerScheduler causes
trigger misfires on each application restart)
> QuartzScheduledPollConsumerScheduler causes trigger misfires on each
> application start
> --------------------------------------------------------------------------------------
>
> Key: CAMEL-11632
> URL: https://issues.apache.org/jira/browse/CAMEL-11632
> Project: Camel
> Issue Type: Bug
> Components: camel-quartz2
> Affects Versions: 2.19.0
> Environment: *strong text*
> Reporter: Viktor Khoroshko
>
> Recently I noticed that on application start Quartz founds and triggers
> misfired triggers:
> {code:java}
> INFO o.s.s.q.LocalDataSourceJobStore - Handling 1 trigger(s) that missed
> their scheduled fire-time.
> {code}
> That wasn't not the realistic case in my scenario - since I could see in a
> database that NEXT_FIRE_TIME is much ahead of the current time.
> After digging a little I found the issue in the
> *QuartzScheduledPollConsumerScheduler*:
> {code:java}
> // Ensure the cron schedule is updated
> CronTrigger newTrigger =
> existingTrigger.getTriggerBuilder().withSchedule(CronScheduleBuilder.cronSchedule(getCron()).inTimeZone(getTimeZone())).build();
> quartzScheduler.rescheduleJob(triggerKey, newTrigger);
> {code}
> There 2 issues here:
> 1. Job is rescheduled even if nothing has been changed (i.e. cron expression,
> crom timezone)
> 2. existingTrigger.getTriggerBuilder() returns trigger builder with
> START_TIME of existing trigger which, surely, is the past. This is causing
> the described bug - NEXT_FIRE_TIME is calculated based on the old START_TIME
> and is in the past also. So rescheduled trigger becomes misfired trigger
> immediately.
> Proposal:
> 1. Do not reschedule job is nothing has been changed.
> 2. If job needs to be rescheduler - make sure to set START_TIME to a current
> date.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)