Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.
CronScheduledRoutePolicyAvailable as of Camel version 2.6 CronScheduledRoutePolicy is a ScheduledRoutePolicy that facilitates route activation, de-activation, suspension and resumption of routes based on a Quartz Maven users will need to add a camel-quartz dependency to their <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-quartz</artifactId> <version>x.x.x</version> <!-- use the same version as your Camel core version --> </dependency> Relationship to the [Quartz] component All Scheduled route policies share the scheduler created by the Quartz component. In this way, scheduler, jobs and triggers can be managed in a common and consistent way. Relationship to the [Quartz2] component From Camel 2.12.2 onwards you can also make use of the Quartz2 based implementation of this route policy. <bean id="myStartPolicy" class="org.apache.camel.routepolicy.quartz2.CronScheduledRoutePolicy"> <!-- start every 5min from monday to saturday --> <property name="routeStartTime" value="0 0/5 * ? * 1-6 *" /> </bean> How it worksIn order to use a CronScheduledRoutePolicy it is necessary to instantiate an object of the type In order to perform a route operation at a given time the following information must be provided.
Once the Configuring the policy
CronScheduledRoutePolicy startPolicy = new CronScheduledRoutePolicy(); startPolicy.setRouteStartTime("*/3 * * * * ?"); from("direct:start") .routeId("testRoute").routePolicy(startPolicy).noAutoStartup() .to("mock:success");
<bean id="startPolicy" class="org.apache.camel.routepolicy.quartz.CronScheduledRoutePolicy"> <property name="routeStartTime" value="*/3 * * * * ?"/> </bean> <camelContext xmlns="http://camel.apache.org/schema/spring"> <route id="testRoute" routePolicyRef="startPolicy" autoStartup="false"> <from uri="direct:start"/> <to uri="mock:success"/> </route> </camelContext> See AlsoScheduledRoutePolicy - for information on policy based scheduling capability for camel routes |