Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9424

CronScheduledRoutePolicy regression introduced with 2.16, setting both start and stop route times fails with duplicate trigger

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.16.0, 2.16.1
    • Fix Version/s: 2.16.2, 2.17.0
    • Component/s: camel-quartz2
    • Labels:
      None
    • Estimated Complexity:
      Unknown
    • Regression:
      Regression

      Description

      This commit created a regression whereby if you set both a start and a stop route time on a CronScheduledRoutePolicy, like:

      CronScheduledRoutePolicy policy = new CronScheduledRoutePolicy();
      policy.setRouteStartTime("*/3 * * * * ?");
      policy.setRouteStopTime("*/5 * * * * ?");
      

      then adding the Quartz triggers will fail because of duplicate trigger names.
      Basically, the start and stop triggers will have the same name because of this line.

      org.apache.camel.FailedToCreateRouteException: Failed to create route test: Route(test)[[From[direct:start]] -> [To[mock:success]]] because of org.quartz.ObjectAlreadyExistsException: Unable to store Trigger with name: 'trigger-START-test' and group: 'triggerGroup-test', because one already exists with this identification.
      
      	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:201)
      	at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:949)
      	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3261)
      	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2984)
      	at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:176)
      	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2814)
      	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2810)
      	at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2833)
      	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2810)
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
      	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2779)
      	at org.apache.camel.routepolicy.quartz2.CronScheduledRoutePolicyTest.testScheduledStartAndStopRoutePolicy(CronScheduledRoutePolicyTest.java:179)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
      	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
      	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
      Caused by: org.apache.camel.RuntimeCamelException: org.quartz.ObjectAlreadyExistsException: Unable to store Trigger with name: 'trigger-START-test' and group: 'triggerGroup-test', because one already exists with this identification.
      	at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1642)
      	at org.apache.camel.routepolicy.quartz2.CronScheduledRoutePolicy.onInit(CronScheduledRoutePolicy.java:41)
      	at org.apache.camel.impl.DefaultRouteContext.commit(DefaultRouteContext.java:220)
      	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1076)
      	at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196)
      	... 43 more
      Caused by: org.quartz.ObjectAlreadyExistsException: Unable to store Trigger with name: 'trigger-START-test' and group: 'triggerGroup-test', because one already exists with this identification.
      ...
      

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              donovanmuller1984 Donovan Muller
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: