コード例 #1
0
ファイル: ControlChannel.java プロジェクト: hyperthunk/axiom
 /**
  * Stops all the underlying services, jobs and worker threads.
  *
  * @throws LifecycleException in the face of termination failure(s).
  */
 public void destroy() {
   log.info("Destroying control channel.");
   try {
     getContext().stop();
   } catch (Exception e) {
     throw new LifecycleException(e.getLocalizedMessage(), e);
   }
 }
コード例 #2
0
ファイル: ControlChannel.java プロジェクト: hyperthunk/axiom
 /**
  * Adds a set of routing/configuration rules to the host {@link CamelContext} using the supplied
  * {@link RouteLoader}.
  *
  * @param loader The loader for the routes you wish to load.
  */
 public void load(final RouteLoader loader) {
   notNull(loader, "Route loader cannot be null.");
   try {
     log.debug("Adding routes to context {}.", hostContext.getName());
     hostContext.addRoutes(loader.load());
   } catch (Exception e) {
     throw new LifecycleException(e.getLocalizedMessage(), e);
   }
 }
コード例 #3
0
ファイル: ControlChannel.java プロジェクト: hyperthunk/axiom
  /**
   * Activates the control channel, which will from now on behave in accordance with the routes you
   * set up in your bootstrap script(s).
   *
   * <p>See {@link ControlChannel#waitShutdown} and {@link ControlChannel#sendShutdownSignal()} for
   * instructions on shutting down an activated channel.
   */
  public void activate() {
    try {
      log.info("Activating control channel.");
      final CamelContext context = getContext();

      log.info("Configuring trace interceptor for {}.", context.getName());
      TraceBuilder builder = new TraceBuilder(getConfig(), tracer);
      context.addInterceptStrategy(builder.build());

      log.debug("Starting underlying camel context.");
      context.start();
    } catch (Exception e) {
      throw new LifecycleException(e.getLocalizedMessage(), e);
    }
  }