use of org.apache.camel.component.quartz.QuartzComponent in project camel by apache.
the class CronScheduledRoutePolicy method doOnInit.
protected void doOnInit(Route route) throws Exception {
QuartzComponent quartz = route.getRouteContext().getCamelContext().getComponent("quartz", QuartzComponent.class);
setScheduler(quartz.getScheduler());
if (getRouteStopGracePeriod() == 0) {
setRouteStopGracePeriod(10000);
}
if (getTimeUnit() == null) {
setTimeUnit(TimeUnit.MILLISECONDS);
}
// validate time options has been configured
if ((getRouteStartTime() == null) && (getRouteStopTime() == null) && (getRouteSuspendTime() == null) && (getRouteResumeTime() == null)) {
throw new IllegalArgumentException("Scheduled Route Policy for route {} has no start/stop/suspend/resume times specified");
}
registerRouteToScheduledRouteDetails(route);
if (getRouteStartTime() != null) {
scheduleRoute(Action.START, route);
}
if (getRouteStopTime() != null) {
scheduleRoute(Action.STOP, route);
}
if (getRouteSuspendTime() != null) {
scheduleRoute(Action.SUSPEND, route);
}
if (getRouteResumeTime() != null) {
scheduleRoute(Action.RESUME, route);
}
}
use of org.apache.camel.component.quartz.QuartzComponent in project camel by apache.
the class SimpleScheduledRoutePolicy method doOnInit.
protected void doOnInit(Route route) throws Exception {
QuartzComponent quartz = route.getRouteContext().getCamelContext().getComponent("quartz", QuartzComponent.class);
setScheduler(quartz.getScheduler());
if (getRouteStopGracePeriod() == 0) {
setRouteStopGracePeriod(10000);
}
if (getTimeUnit() == null) {
setTimeUnit(TimeUnit.MILLISECONDS);
}
// validate time options has been configured
if ((getRouteStartDate() == null) && (getRouteStopDate() == null) && (getRouteSuspendDate() == null) && (getRouteResumeDate() == null)) {
throw new IllegalArgumentException("Scheduled Route Policy for route {} has no start/stop/suspend/resume times specified");
}
registerRouteToScheduledRouteDetails(route);
if (getRouteStartDate() != null) {
scheduleRoute(Action.START, route);
}
if (getRouteStopDate() != null) {
scheduleRoute(Action.STOP, route);
}
if (getRouteSuspendDate() != null) {
scheduleRoute(Action.SUSPEND, route);
}
if (getRouteResumeDate() != null) {
scheduleRoute(Action.RESUME, route);
}
}
Aggregations