[jira] [Commented] (CAMEL-11632) QuartzScheduledPollConsumerScheduler causes trigger misfires on each application start
[ https://issues.apache.org/jira/browse/CAMEL-11632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16162796#comment-16162796 ] Claus Ibsen commented on CAMEL-11632: - The existing quartz consumer already does that by checking of the cron/tz was changed and then only does a reschedule if needed. > 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 >Reporter: Viktor Khoroshko >Assignee: Claus Ibsen > Fix For: 2.19.4, 2.20.0 > > > 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, > cron 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 if nothing has been changed. > 2. If job needs to be rescheduled - make sure to set START_TIME to a current > date. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CAMEL-11632) QuartzScheduledPollConsumerScheduler causes trigger misfires on each application start
[ https://issues.apache.org/jira/browse/CAMEL-11632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16116115#comment-16116115 ] Claus Ibsen commented on CAMEL-11632: - You are welcome to work on a contribution > 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, > cron 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 if nothing has been changed. > 2. If job needs to be rescheduled - make sure to set START_TIME to a current > date. -- This message was sent by Atlassian JIRA (v6.4.14#64029)