Exemple #1
0
 public void shutdown(long timeout) throws Exception {
   if (!context.getStatus().isStarted()) {
     throw new IllegalArgumentException("CamelContext is not started");
   }
   String routeId = getRouteId();
   context.stopRoute(routeId, timeout, TimeUnit.SECONDS);
   context.removeRoute(routeId);
 }
  private void removeRoutes() {
    LOGGER.trace("ENTERING: stopRoutes");
    List<RouteDefinition> routeDefinitions = camelContext.getRouteDefinitions();
    for (RouteDefinition routeDef : routeDefinitions) {
      try {
        // Only remove routes that this Content Directory Monitor created
        // (since same camelContext shared across all ContentDirectoryMonitors
        // this is necessary)
        if (isMyRoute(routeDef.getId())) {
          LOGGER.trace("Stopping route with ID = " + routeDef.getId());
          camelContext.stopRoute(routeDef); // DEPRECATED
          //                    camelContext.stopRoute(routeDef.getId());
          boolean status = camelContext.removeRoute(routeDef.getId());
          LOGGER.trace("Status of removing route " + routeDef.getId() + " is " + status);
          camelContext.removeRouteDefinition(routeDef);
        }
      } catch (Exception e) {
        LOGGER.warn("Unable to stop Camel route with route ID = " + routeDef.getId(), e);
      }
    }

    LOGGER.trace("EXITING: stopRoutes");
  }
Exemple #3
0
 public boolean remove() throws Exception {
   if (!context.getStatus().isStarted()) {
     throw new IllegalArgumentException("CamelContext is not started");
   }
   return context.removeRoute(getRouteId());
 }