Пример #1
0
 private void dumpCamelContext(String msg) {
   LOGGER.debug("\n\n***************  START: " + msg + "  *****************");
   List<RouteDefinition> routeDefinitions = camelContext.getRouteDefinitions();
   if (routeDefinitions != null) {
     LOGGER.debug("Number of routes = " + routeDefinitions.size());
     for (RouteDefinition routeDef : routeDefinitions) {
       String routeId = routeDef.getId();
       LOGGER.debug("route ID = " + routeId);
       List<FromDefinition> routeInputs = routeDef.getInputs();
       if (routeInputs.isEmpty()) {
         LOGGER.debug("routeInputs are EMPTY");
       } else {
         for (FromDefinition fromDef : routeInputs) {
           LOGGER.debug("route input's URI = " + fromDef.getUri());
         }
       }
       ServiceStatus routeStatus = camelContext.getRouteStatus(routeId);
       if (routeStatus != null) {
         LOGGER.debug("Route ID " + routeId + " is started = " + routeStatus.isStarted());
       } else {
         LOGGER.debug("routeStatus is NULL for routeId = " + routeId);
       }
     }
   }
   LOGGER.debug("***************  END: " + msg + "  *****************\n\n");
 }
Пример #2
0
 @ManagedAttribute(description = "Service State")
 public String getState() {
   ServiceStatus status = this.getStatus();
   // if no status exists then its stopped
   if (status == null) {
     status = ServiceStatus.Stopped;
   }
   return status.name();
 }
Пример #3
0
 public String getState() {
   // must use String type to be sure remote JMX can read the attribute without requiring Camel
   // classes.
   ServiceStatus status = context.getRouteStatus(route.getId());
   // if no status exists then its stopped
   if (status == null) {
     status = ServiceStatus.Stopped;
   }
   return status.name();
 }
Пример #4
0
  public String getState() {
    // must use String type to be sure remote JMX can read the attribute without requiring Camel
    // classes.
    if (processor instanceof StatefulService) {
      ServiceStatus status = ((StatefulService) processor).getStatus();
      return status.name();
    }

    // assume started if not a ServiceSupport instance
    return ServiceStatus.Started.name();
  }
Пример #5
0
 private void startRoute(RouteDefinition routeDef) {
   String routeId = routeDef.getId();
   try {
     if (isMyRoute(routeId)) {
       ServiceStatus routeStatus = camelContext.getRouteStatus(routeId);
       // Only start the route if it is not already started
       if (routeStatus == null || !routeStatus.isStarted()) {
         LOGGER.trace("Starting route with ID = " + routeId);
         camelContext.startRoute(routeDef); // DEPRECATED
         // this method does not reliably start a route that was created, then
         // app shutdown, and restarted
         //                camelContext.startRoute(routeId);
       }
     }
   } catch (Exception e) {
     LOGGER.warn("Unable to start Camel route with route ID = " + routeId, e);
   }
 }