[ 
https://issues.apache.org/jira/browse/CAMEL-3239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12977046#action_12977046
 ] 

Tracy Snell commented on CAMEL-3239:
------------------------------------

Here's the code from  QuartzComponent that's the issue:
{code}
    private void doAddJob(JobDetail job, Trigger trigger) throws 
SchedulerException {
        JOBS.incrementAndGet();

        Trigger existingTrigger = getScheduler().getTrigger(trigger.getName(), 
trigger.getGroup());
        if (existingTrigger == null) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Adding job using trigger: " + trigger.getGroup() + 
"/" + trigger.getName());
            }
            getScheduler().scheduleJob(job, trigger);
        } else if (hasTriggerChanged(existingTrigger, trigger)) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Trigger: " + trigger.getGroup() + "/" + 
trigger.getName() + " already exists and will be updated by Quartz.");
            }
            scheduler.addJob(job, true);
            trigger.setJobName(job.getName());
            scheduler.rescheduleJob(trigger.getName(), trigger.getGroup(), 
trigger);
        } else {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Trigger: " + trigger.getGroup() + "/" + 
trigger.getName() + " already exists and will be resumed automatically by 
Quartz.");
            }
            if (!isClustered()) {
                scheduler.resumeTrigger(trigger.getName(), trigger.getGroup());
            }
        }
    }
{code}

Thinking out loud...

One issue is a job could be clustered. 
- We'll need to check the local endpoint for dupes, not see if it's already in 
the scheduler. 
- What if the same timer name is in 2 different contexts? Do we assume that's 
intentional and let it happen or error on that also?

> camel-quartz should require unique timername
> --------------------------------------------
>
>                 Key: CAMEL-3239
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3239
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-quartz
>    Affects Versions: 2.4.0
>            Reporter: Bengt Rodehav
>            Priority: Minor
>             Fix For: 2.6.0
>
>
> I'm using camel-quartz (Camel 2.4) and have some problems with the timer name 
> (part of the URI).
> It seems that if I have two different routes (using camel-quartz) with the 
> same timername, only one of the quartz endpoints will be activated, e g:
> from("quartz://mytimername"?cron=0+*+*+*+*+?+*").to(endpoint1)
> from("quartz://mytimername"?cron=30+*+*+*+*+?+*").to(endpoint2)
> If I make sure that the timernames are unique, both quartz endpoints will 
> work. Thus I conclude that the timername must be unique (maybe this is a 
> quartz thing and not a camel-quartz thing).
> However, I get no indication that something is wrong since the camel route is 
> started and looks fine although the quartz endpoint will never trigger. This 
> is not a good situation. In my case I use this for monitoring purposes. I 
> thought that the monitoring worked fine but it was actually never triggered 
> at all.
> I'm not sure if this due to camel-quartz or quartz itself. However, if it is 
> possible for camel-quartz to determine that the endpoint was created OK (not 
> OK if duplicate timer names), then this should case the camel context to fail.
> I run this in an OSGi environment (Karaf 1.6.0). Thus routes like the above 
> can be created independent of each other which makes it hard to guarantee 
> that the timername is unique.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to