Ah you may have hit a corner issue. You can indicate a route is stopped using .noAutoStartup in the DSL. But we need to initialize the CronScheduledRoutePolicy regardless what. It should have a start method you can invoke manually thought.
But check its source code to be sure. And maybe you need to associate a route id to it, so it has the id to use for starting the route. Or the code need to be enhanced for this scenario. On Tue, Mar 29, 2011 at 1:21 PM, mikaelfj <mikae...@gmail.com> wrote: > Hi, > > I'm in the process of using CronScheduledRoutePolicy to schedule a route to > start and stop - i.e. to only be polling the from endpoint in a certain > time-interval - e.g. the below should ensure it only polls the from endpoint > one hour each day between 16-17: > > CronScheduledRoutePolicy policy = new CronScheduledRoutePolicy(); > policy.setRouteStartTime("0 0 16 ? * *"); > policy.setRouteStopTime("0 0 17 ? * *"); > from(...) > .routeId(routeId) > .routePolicy(policy) > .process(...) > > As far as I can tell from my test, the setting of the routePolicy does not > automatically ensure that the route is stopped when I e.g. start the route, > say, at 11. > So I assume that the routePolicy just ensures that it will trigger at start > at 16 and a stop at 17 - but I need to ensure manually that if started at 11 > it is initially in the stopped state - is that correctly understood? > > We are building our routes inside an implementation of the > RouteBuilder.configure method e.g. like: > > public void configure() throws Exception { > CronScheduledRoutePolicy policy = new CronScheduledRoutePolicy(); > policy.setRouteStartTime("0 0 16 ? * *"); > policy.setRouteStopTime("0 0 17 ? * *"); > from(...) > .routeId(routeId) > .routePolicy(policy) > .process(...) > } > > This is different from e.g. the unit tests that shows how to start the > context and then stop a route. > So, how do I, in the implementation of the RouteBuilder.configure method > ensure that the route is initially stopped if the route is about to be > startet at 11? > > Regards > Mikael > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Scheduling-routes-with-RoutePolicy-tp4269200p4269200.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/