Exemple #1
0
 /**
  * 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);
   }
 }
Exemple #2
0
  /**
   * 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);
    }
  }
Exemple #3
0
 public ControlChannel(
     final CamelContext hostContext, final Tracer tracer, final Configuration config) {
   this(
       hostContext,
       tracer,
       config,
       hostContext.getRegistry().lookup(Environment.SHUTDOWN_CHANNEL_ID, ShutdownChannel.class));
 }