public void validate(CamelContext context) { if ((targetId == null || targetId.trim().isEmpty()) && route != null) { targetId = route.getId(); } route = context.getRouteDefinition(targetId); if (route == null) { throw new RuntimeCamelException("Failed to find RouteDefinition with id: " + targetId); } }
public void validate(CamelContext context) { //check if a route Object result = context.getRouteDefinition(fromId); if (result == null) { //check if an endpoint result = context.getEndpoint(fromId); } if (result == null) { throw new RuntimeCamelException("Failed to find RouteDefinition with id: " + fromId); } }
@WriteOperation public String getRouteDump(@Selector String id) { if (this.properties.isReadOnly()) { throw new IllegalArgumentException("Read only: route dump is not permitted in read-only mode"); } RouteDefinition route = camelContext.getRouteDefinition(id); if (route != null) { try { return ModelHelper.dumpModelAsXml(camelContext, route); } catch (Exception e) { throw ObjectHelper.wrapRuntimeCamelException(e); } } return null; }
public void killExistingRoute(String routeId, boolean fireEvent) throws Exception { //Active routes Route route = camelContext.getRoute(routeId); if (route != null) { RouteDefinition routeDefinition = camelContext.getRouteDefinition(routeId); if (routeDefinition != null) { camelContext.removeRouteDefinition(routeDefinition); } } if (fireEvent) { UpdateCamelRouteEvent event = new UpdateCamelRouteEvent(EVENT_ID_REMOVE); event.setRouteId(routeId); clusterService.sendEvent(event); } }
private void reportNonCustomRouteIDs(Route route) { CamelContext camelContext = route.getRouteContext().getCamelContext(); RouteDefinition routeDefinition = camelContext.getRouteDefinition(route.getId()); if (routeDefinition.getCustomId() == null || !routeDefinition.getCustomId()) { LOG.warn("Problem detected: Route " + StringUtils.quote(route.getId()) + " has no custom ID set! Endpoint URI is " + route.getEndpoint().getEndpointUri()); } }