/** * If the integration has a scheduler, start the route with a timer or quartz2 * endpoint. */ private ProcessorDefinition<?> configureRouteScheduler(final Flow flow) throws URISyntaxException { if (flow.getScheduler().isPresent()) { Scheduler scheduler = flow.getScheduler().get(); // We now support simple timer only, cron support will be supported // later on. if (scheduler.isTimer()) { Map<String, String> properties = new HashMap<>(); properties.put("timerName", "integration"); properties.put("period", scheduler.getExpression()); final RuntimeCamelCatalog catalog = getContext().getRuntimeCamelCatalog(); final String uri = catalog.asEndpointUri("timer", properties, false); RouteDefinition route = this.from(uri); route.getInputs().get(0).setId("integration-scheduler"); flow.getId().ifPresent(route::setId); return route; } else { throw new IllegalArgumentException("Unsupported scheduler type: " + scheduler.getType()); } } return null; }