You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by briane80 <be...@ccea.org.uk> on 2015/09/15 00:39:12 UTC

Configure a camel route to start and stop at certain time of day

Hi,

I have a requirement where my camel route should only pick up new messages
between 8am and 10pm due to database backups and other nightly processes.

I have looked at the SimpleScheduledRoutePolicy class but i'm not sure how
to use it to start and stop routes at predefined times every day. Cann
someone provide an example of how to configure this (i'm using camel 2.12
and mainly xml based config).

Thanks,

Brian



--
View this message in context: http://camel.465427.n5.nabble.com/Configure-a-camel-route-to-start-and-stop-at-certain-time-of-day-tp5771520.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Configure a camel route to start and stop at certain time of day

Posted by briane80 <be...@ccea.org.uk>.
I think this will work (was easier than expected!):

In xml:

<bean id="timePolicy"
class="org.apache.camel.routepolicy.quartz2.CronScheduledRoutePolicy">
 		<property name="routeStartTime" value="0 0 8 * * ?"/>
                <property name="routeStopTime" value="0 0 22 * * ?"/>
</bean>

In route declaration:

from(routes.get(A2CMessageDefaultValues.TRANSPORT_INBOX)).routeId("A2cMessageService")
.routePolicyRef("timePolicy").beanRef("messagePreProcessor").choice()

....



--
View this message in context: http://camel.465427.n5.nabble.com/Configure-a-camel-route-to-start-and-stop-at-certain-time-of-day-tp5771520p5771547.html
Sent from the Camel - Users mailing list archive at Nabble.com.