title: Apache Camel quartz2 doesn't apply changed cron expression
body: <p>I'm trying to use camel-quartz2 component in a cluster mode with JDBCJobStore.</p>
  
  <p><strong>quartz.properties</strong> file:</p>
  
  <pre><code>org.quartz.scheduler.instanceId=AUTO
  org.quartz.scheduler.instanceName=JobCluster
  
  org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
  org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
  org.quartz.jobStore.dataSource=dsQuartzTest
  
  org.quartz.jobStore.isClustered=true
  
  org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
  org.quartz.threadPool.threadCount=5
  org.quartz.dataSource.dsQuartzTest.driver = oracle.jdbc.driver.OracleDriver
  org.quartz.dataSource.dsQuartzTest.URL = jdbc:oracle:thin:pmuser@//10.13.13.10:1521/PDB1
  org.quartz.dataSource.dsQuartzTest.user = pmuser
  org.quartz.dataSource.dsQuartzTest.password = oracle
  org.quartz.dataSource.dsQuartzTest.maxConnections = 10
  </code></pre>
  
  <p><strong>camel-context.xml</strong> file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!-- Configures the Camel Context--&gt;
  
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:camel="http://camel.apache.org/schema/spring"
         xsi:schemaLocation="
         http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://camel.apache.org/schema/spring
         http://camel.apache.org/schema/spring/camel-spring.xsd"&gt;
  
      &lt;bean id="quartz2" class="org.apache.camel.component.quartz2.QuartzComponent"&gt;
          &lt;property name="propertiesFile" value="quartz.properties"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="quartzBean" class="com.ubs.rbs.integration.QuartzBean"/&gt;
  
      &lt;camel:camelContext xmlns="http://camel.apache.org/schema/spring"&gt;
  
          &lt;camel:route id="quartzRoute"&gt;
              &lt;camel:from uri="quartz2://tictac?cron=0+0/5+*+1/1+*+?+*"/&gt;
              &lt;camel:setBody&gt;
                  &lt;camel:simple&gt;
                      ${header.triggerName} - ${header.fireTime}
                  &lt;/camel:simple&gt;
              &lt;/camel:setBody&gt;
              &lt;camel:to uri="log:hello"/&gt;
          &lt;/camel:route&gt;
  
  &lt;!--
          &lt;camel:route&gt;
              &lt;camel:from uri="timer://updateQuartzRoute?repeatCount=1"/&gt;
              &lt;camel:to uri="bean:quartzBean?method=reschedule(*,'quartzRoute')"/&gt;
          &lt;/camel:route&gt;
  --&gt;
  
      &lt;/camel:camelContext&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>When I first start the application, camel-quartz2 component schedules job with appropriate cron expression, and all works just OK. But, when I stop all instances of app, trigger remains in a WAITING state (it's, probably, OK for cluster, as component cannot tell when last instance is stopped, also, I cannot tell if this point is relevant, but without cluster it seems was no issue). So, when I start app next time trigger is already exists and its settings won't apply. Importantly, when I change cron expression and restart all instances, quartz uses old expression from DB, not new one from component's uri.</p>
  
  <p>I found a workaround for this issue, using additional route (commented out in the xml above) to reschedule quartz in the custom bean as below:</p>
  
  <pre><code>public class QuartzBean {
  
      public void reschedule(CamelContext context, String quartzRouteId) throws Exception {
          QuartzEndpoint endpoint = (QuartzEndpoint) context.getRoute(quartzRouteId).getEndpoint();
          QuartzComponent component = endpoint.getComponent();
          Scheduler scheduler = component.getScheduler();
  
          Trigger oldTrigger = scheduler.getTrigger(endpoint.getTriggerKey());
          TriggerBuilder tb = oldTrigger.getTriggerBuilder();
  
          Trigger newTrigger = tb.withSchedule(CronScheduleBuilder.cronSchedule(endpoint.getCron())).build();
  
          scheduler.rescheduleJob(oldTrigger.getKey(), newTrigger);
      }
  }
  </code></pre>
  
  <p>Alternatively, I can patch camel-quartz2 component as below (org.apache.camel.component.quartz2.QuartzEndpoint#addJobInScheduler):</p>
  
  <pre><code>private void addJobInScheduler() throws Exception {
      // Add or use existing trigger to/from scheduler
      Scheduler scheduler = getComponent().getScheduler();
      JobDetail jobDetail;
      boolean triggerExisted = scheduler.getTrigger(triggerKey) != null;
      if (triggerExisted) {
          ensureNoDupTriggerKey();
      }
  
      jobDetail = createJobDetail();
      Trigger trigger = createTrigger(jobDetail);
  
      updateJobDataMap(jobDetail);
  
      // Schedule it now. Remember that scheduler might not be started it, but we can schedule now.
      Date nextFireDate = triggerExisted ? scheduler.rescheduleJob(triggerKey, trigger) : scheduler.scheduleJob(jobDetail, trigger);
      if (LOG.isInfoEnabled()) {
          LOG.info("Job {} (triggerType={}, jobClass={}) is scheduled. Next fire date is {}",
                   new Object[] {trigger.getKey(), trigger.getClass().getSimpleName(),
                                 jobDetail.getJobClass().getSimpleName(), nextFireDate});
      }
  
      // Increase camel job count for this endpoint
      AtomicInteger number = (AtomicInteger) scheduler.getContext().get(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT);
      if (number != null) {
          number.incrementAndGet();
      }
  
      jobAdded.set(true);
  }
  </code></pre>
  
  <p>Unlike the current version in the project's repository, my version always creates new trigger and reschedules job if trigger already existed.</p>
  
  <p>My questions are: Am I missing something obvious? How this component supposed to work in such scenario? Should I try to change component itself or is there a better way to change its schedule from outside?</p>
  
  <p>UPD: I tried versions 2.13.1 from maven and 2.14.SNAPSHOT from sources.</p>