[
https://issues.apache.org/jira/browse/CAMEL-27171?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-27171 started by shashank.
----------------------------------------
> camel-quartz - the Quartz poll scheduler fails to start when its trigger is
> already in the scheduler with the same cron
> -----------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27171
> URL: https://issues.apache.org/jira/browse/CAMEL-27171
> Project: Camel
> Issue Type: Bug
> Components: camel-quartz
> Reporter: shashank
> Assignee: shashank
> Priority: Major
>
> h3. What happens
> {{QuartzScheduledPollConsumerScheduler}} (a polling consumer with
> {{scheduler=quartz}}) with a {{scheduler.triggerId}} looks up its trigger
> when it starts. When the trigger is already in the Quartz scheduler and the
> cron did not change, {{startScheduler}} still calls {{scheduleJob(job,
> trigger)}}, which throws {{ObjectAlreadyExistsException}}. The exception is
> ignored only with a clustered job store, so the route does not start.
> The trigger is already there:
> * after a route stop and start with {{scheduler.deleteJob=false}} (the
> trigger is kept on stop);
> * with a persistent (JDBC) job store that is not clustered, after the
> application did not stop gracefully (killed, crashed): the application cannot
> start until the trigger is removed from the database.
> The code means to reuse the trigger ("Trigger with key ... is already present
> in scheduler. Only updating it."), and does so when the cron changed
> ({{rescheduleJob}}).
> Also, the check that the trigger is not used by another route
> ({{checkTriggerIsNonConflicting}}) reads the route id from the job data map
> of the trigger, but the route id is stored on the job, so it never finds it:
> two routes with the same trigger id and group are not detected (with a
> clustered job store the second route starts, and never polls).
> h3. How to reproduce
> {{FileConsumerQuartzSchedulerExistingTriggerTest}} (camel-quartz): start,
> stop and start a file route with {{scheduler.deleteJob=false}}; and start a
> route whose trigger and job are already in the scheduler. Both starts fail
> with {{ObjectAlreadyExistsException}}.
> h3. Fix
> When the trigger is already in the scheduler with the same cron, the
> scheduler uses it instead of scheduling it again. The conflict check reads
> the route id from the job. A trigger key used by another route then fails the
> start with an {{IllegalArgumentException}} naming that route, also with a
> clustered job store (upgrade guide entry).
> _Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)