Reputation: 1648
I wrote a apache timer which runs after every 5min. But now I need to run it only from 8am to 10pm. How can I do that? I did not find any such in apache camel documentation.
<route id="transactionHeath" startupOrder="1">
<from uri="timer:transactionHeath?delay=1000&fixedRate=true&period=300s" />
//logic
</route>
Upvotes: 2
Views: 1212
Reputation: 2820
Take a look at http://camel.apache.org/cronscheduledroutepolicy.html where you may configure a quartz based policy like this
<bean id="startPolicy" class="org.apache.camel.routepolicy.quartz.CronScheduledRoutePolicy">
<property name="routeStartTime" value="0 0/5 8-22 ? * *"/>
</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>
Upvotes: 2