shashank created CAMEL-27287:
--------------------------------
Summary: camel-quartz - with durableJob=true a route that was
removed cannot be added again, and with a persistent job store the application
does not start a second time
Key: CAMEL-27287
URL: https://issues.apache.org/jira/browse/CAMEL-27287
Project: Camel
Issue Type: Bug
Components: camel-quartz
Reporter: shashank
Assignee: shashank
h3. What happens
With {{durableJob=true}} and the default {{deleteJob=true}}, a Quartz endpoint
unschedules its trigger when it stops (the route is removed, or CamelContext
stops), and Quartz keeps the durable job. The next endpoint with that trigger
key finds no trigger and calls {{scheduler.scheduleJob(jobDetail, trigger)}},
which fails with {{ObjectAlreadyExistsException: Unable to store Job ...
because one already exists with this identification}} because the job is still
stored.
* A route such as {{from("quartz://myGroup/myTimer?durableJob=true&cron=...")}}
cannot be added again after it was removed (route reload in dev mode, routes
removed and added at runtime): {{FailedToCreateRouteException}}.
* With a persistent (JDBC) job store, the application fails to start every time
after it stopped once.
* A clustered job store is not affected by the stop (the endpoint does not
unschedule there), but a durable job whose trigger was removed in another way
(a simple trigger that fired its last repeat, or the Quartz API) fails the
start there with {{SchedulerException: Trigger could not be found in quartz
scheduler.}}
A route stop/start is not affected (it pauses and resumes the trigger).
h3. How to reproduce
{{QuartzDurableJobScheduleAgainTest}} (camel-quartz, RAM job store): stop,
remove and add again a route with {{durableJob=true}}; or store a durable job
without a trigger and add the route.
h3. Fix
In {{QuartzEndpoint.addJobInScheduler}}, when the trigger is missing and only
the job is in the scheduler, store the job of the endpoint in place of the
stored one and schedule it with the trigger ({{scheduleJob(jobDetail,
Set.of(trigger), true)}}). CAMEL-27171 handled the same case in
{{QuartzScheduledPollConsumerScheduler}}.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)