1) When you want to execute a job at certain specific time of day or month or year etc.
2) When you want to consume from some endpoint (jms, file, sftp etc) at specific time of day. months yeart etc.
For First :
from("quartz2://myGroup/myTimerName?trigger.repeatInterval=2&trigger.repeatCount=1")
.routeId("myRoute")
// add here all operation which you want to do.
.end();
Note: Here myGroup and myTimerName are name of the group to which this quartz schedule belong and name is what you want this quartz schedule to be called.
Refer : Camel quartz2
For second :
CronScheduledRoutePolicy startPolicy = new CronScheduledRoutePolicy();startPolicy.setRouteStartTime("*/3 * * * * ?"); from("file://inbox?preMove=inprogress&move=.done") .routeId("testRoute").routePolicy(startPolicy).noAutoStartup() // add here all the operation you want to do. .to("mock:success");Refer : Camel cronscheduledroutepolicy
No comments:
Post a Comment