Prasanth Ganesh Rao created CAMEL-24055:
-------------------------------------------

             Summary: QuartzEndpoint custom calendar name collision when 
multiple routes use customCalendar
                 Key: CAMEL-24055
                 URL: https://issues.apache.org/jira/browse/CAMEL-24055
             Project: Camel
          Issue Type: Bug
          Components: camel-quartz
    Affects Versions: 4.x
            Reporter: Prasanth Ganesh Rao


When two or more Quartz routes in the same CamelContext are configured with a 
customCalendar, the second route silently overwrites the first route's calendar 
in the shared Quartz scheduler.

*Root cause:*

QuartzEndpoint.doStart() registers every custom calendar under the hardcoded 
name "CamelQuartzCustomCalendar" (QuartzConstants.QUARTZ_CAMEL_CUSTOM_CALENDAR):

{{scheduler.addCalendar("CamelQuartzCustomCalendar", customCalendar, true, 
false);}}

The replace=true flag causes the second addCalendar() call to silently 
overwrite the first. Since all triggers are also wired to the same name via 
modifiedByCalendar("CamelQuartzCustomCalendar"), every trigger ends up governed 
by whichever calendar registered last — not the one intended for it.

*Example:*

{{// Route A: fires at most once per day (30-second recurrence calendar)}}
{{{}from("quartz://FrequentTimer?customCalendar=#frequentCalendar&cron=0/2 * * 
* * ?").to("mock:a");{}}}{{{}// Route B: always-open daily calendar — 
overwrites FrequentTimer's calendar{}}}
{{from("quartz://DailyTimer?customCalendar=#dailyCalendar&cron=0/2 * * * * 
?").to("mock:b");}}

After startup, FrequentTimer fires every 2 seconds instead of being suppressed, 
because its trigger now references DailyTimer's always-open calendar.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to