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

can't use same quartz scheduled route policy on two routes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.8.2
    • 2.8.4, 2.9.0
    • camel-quartz
    • None
    • tomcat6

    • Unknown

    Description

      The following XML DSL defines two routes using the same route policy:

      <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">

      <camel:camelContext xmlns="http://camel.apache.org/schema/spring">
      <camel:propertyPlaceholder id="properties" location="file:///etc/camel/css.properties"/>

      <camel:package>cdp_test</camel:package>
      <camel:route id="r1" routePolicyRef="pol1">
      <camel:from uri="file://data/1"/>
      <camel:to uri="stream:out"/>
      </camel:route>
      <camel:route id="r2" routePolicyRef="pol1">
      <camel:from uri="file://data/2"/>
      <camel:to uri="stream:out"/>
      </camel:route>

      </camel:camelContext>

      <bean id="pol1" class="org.apache.camel.routepolicy.quartz.CronScheduledRoutePolicy">
      <property name="routeStartTime" value="00,30 * * * * ? *"/>
      <property name="routeStopTime" value="10,40 * * * * ? *"/>
      </bean>

      </beans>

      This is the logging output. r2 does not follow the policy:

      [pache.camel.spring.Main.main()] StdSchedulerFactory INFO Quartz scheduler 'DefaultQuartzScheduler-camel-1' initialized from an externally provided properties instance.
      [pache.camel.spring.Main.main()] StdSchedulerFactory INFO Quartz scheduler version: 1.8.4
      [pache.camel.spring.Main.main()] ScheduledRoutePolicy INFO Scheduled trigger: triggerGroup-r1.trigger-START-r1 for action: START on route:
      [pache.camel.spring.Main.main()] ScheduledRoutePolicy INFO Scheduled trigger: triggerGroup-r1.trigger-STOP-r1 for action: STOP on route:
      [pache.camel.spring.Main.main()] SpringCamelContext INFO Route: r1 started and consuming from: Endpointfile://data/1
      [pache.camel.spring.Main.main()] SpringCamelContext INFO Route: r2 started and consuming from: Endpointfile://data/2
      [pache.camel.spring.Main.main()] QuartzComponent INFO Starting Quartz scheduler: DefaultQuartzScheduler-camel-1
      [pache.camel.spring.Main.main()] QuartzScheduler INFO Scheduler DefaultQuartzScheduler-camel-1_$_NON_CLUSTERED started.
      [pache.camel.spring.Main.main()] SpringCamelContext INFO Total 2 routes, of which 2 is started.
      [pache.camel.spring.Main.main()] SpringCamelContext INFO Apache Camel 2.8.2 (CamelContext: camel-1) started in 0.596 seconds
      hello 1
      [artzScheduler-camel-1_Worker-2] DefaultShutdownStrategy INFO Starting to graceful shutdown 1 routes (timeout 10000 milliseconds)
      el-1) thread #2 - ShutdownTask DefaultShutdownStrategy INFO Route: r1 shutdown complete, was consuming from: Endpointfile://data/1
      [artzScheduler-camel-1_Worker-2] DefaultShutdownStrategy INFO Graceful shutdown of 1 routes completed in 0 seconds
      [artzScheduler-camel-1_Worker-2] SpringCamelContext INFO Route: r1 stopped, was consuming from: Endpointfile://data/1
      hello 2
      hello 2
      [artzScheduler-camel-1_Worker-3] SpringCamelContext INFO Route: r1 started and consuming from: Endpointfile://data/1
      hello 2
      [artzScheduler-camel-1_Worker-4] DefaultShutdownStrategy INFO Starting to graceful shutdown 1 routes (timeout 10000 milliseconds)
      el-1) thread #2 - ShutdownTask DefaultShutdownStrategy INFO Route: r1 shutdown complete, was consuming from: Endpointfile://data/1
      [artzScheduler-camel-1_Worker-4] DefaultShutdownStrategy INFO Graceful shutdown of 1 routes completed in 0 seconds
      [artzScheduler-camel-1_Worker-4] SpringCamelContext INFO Route: r1 stopped, was consuming from: Endpointfile://data/1

      If I use two separate identical route policies it works as I expect.

      Attachments

        1. routePolicy.diff
          19 kB
          Bilgin Ismet Ibryam

        Activity

          People

            davsclaus Claus Ibsen
            julian.cable Julian Cable
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: