It is a Quartz cron expression, you can read about it here:
http://quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger

Normally you wouldn't use * with /, but I guess that works as well.
In your configuration it will start every 3 seconds.



2013/4/16 pokkie <[email protected]>

> Hi,
>
> I am looking at the CronScheduledRoutePolicy that is published on the Camel
> Website.
>
> It has the following code snippet:
>
> CronScheduledRoutePolicy startPolicy = new CronScheduledRoutePolicy();
> startPolicy.setRouteStartTime("*/3 * * * * ?");
>
> from("direct:start")
>     .routeId("testRoute").routePolicy(startPolicy).noAutoStartup()
>     .to("mock:success");
>
> What exactly does the */3 represent in the above example?
>
> Does it mean that the route will be started every 3 minutes? I am asking
> because when I run my example the route is continuously being executed.
>
> For completeness here is my code:
>
> public static void main(String[] args)
>   {
>     CamelContext camelContext = new DefaultCamelContext();
>
>     try
>     {
>       camelContext.addRoutes(new RouteBuilder() {
>         @Override
>         public void configure() throws Exception {
>
>           CronScheduledRoutePolicy startPolicy = new
> CronScheduledRoutePolicy();
>           startPolicy.setRouteStartTime("*/3 * * * * ?");
>
>           from("file:data/inbox?noop=true")
>               .routePolicy(startPolicy).noAutoStartup()
>               .to("file:/media/dhd03656/Backup/sharenet");
>         }
>       });
>
>       camelContext.start();
>       Thread.sleep(1000000);
>       camelContext.stop();
>
>     } catch (Exception e) {
>       e.printStackTrace();
>     }
>
>
>   }
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/CronScheduledRoutePolicy-example-tp5730978.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Brgds, Magnus Palmér
+46736845680

Reply via email to