Class ControlBusEndpoint

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.Endpoint, org.apache.camel.IsSingleton, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.HasId, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    @UriEndpoint(firstVersion="2.11.0",
                 scheme="controlbus",
                 title="Control Bus",
                 syntax="controlbus:command:language",
                 producerOnly=true,
                 category={CORE,MONITORING})
    public class ControlBusEndpoint
    extends org.apache.camel.support.DefaultEndpoint
    Manage and monitor Camel routes. For example, by sending a message to an Endpoint you can control the lifecycle of routes, or gather performance statistics.
    • Field Summary

      • Fields inherited from class org.apache.camel.support.service.BaseService

        BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
    • Constructor Summary

      Constructors 
      Constructor Description
      ControlBusEndpoint​(String endpointUri, org.apache.camel.Component component)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.camel.Consumer createConsumer​(org.apache.camel.Processor processor)  
      org.apache.camel.Producer createProducer()  
      protected void doInit()  
      String getAction()  
      ControlBusComponent getComponent()  
      org.apache.camel.spi.Language getLanguage()  
      org.apache.camel.LoggingLevel getLoggingLevel()  
      int getRestartDelay()  
      String getRouteId()  
      boolean isAsync()  
      void setAction​(String action)
      To denote an action that can be either: start, stop, or status.
      void setAsync​(boolean async)
      Whether to execute the control bus task asynchronously.
      void setLanguage​(org.apache.camel.spi.Language language)
      Allows you to specify the name of a Language to use for evaluating the message body.
      void setLoggingLevel​(org.apache.camel.LoggingLevel loggingLevel)
      Logging level used for logging when task is done, or if any exceptions occurred during processing the task.
      void setRestartDelay​(int restartDelay)
      The delay in millis to use when restarting a route.
      void setRouteId​(String routeId)
      To specify a route by its id.
      • Methods inherited from class org.apache.camel.support.DefaultEndpoint

        configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doStart, doStop, equals, getCamelContext, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toString
      • Methods inherited from class org.apache.camel.support.service.BaseService

        build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
      • Methods inherited from interface org.apache.camel.Endpoint

        getEndpointBaseUri, isSingletonProducer
      • Methods inherited from interface org.apache.camel.Service

        build, close, init, start, stop
      • Methods inherited from interface org.apache.camel.ShutdownableService

        shutdown
      • Methods inherited from interface org.apache.camel.StatefulService

        getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
      • Methods inherited from interface org.apache.camel.SuspendableService

        isSuspended, resume, suspend
    • Constructor Detail

      • ControlBusEndpoint

        public ControlBusEndpoint​(String endpointUri,
                                  org.apache.camel.Component component)
    • Method Detail

      • doInit

        protected void doInit()
                       throws Exception
        Overrides:
        doInit in class org.apache.camel.support.DefaultEndpoint
        Throws:
        Exception
      • createProducer

        public org.apache.camel.Producer createProducer()
                                                 throws Exception
        Throws:
        Exception
      • createConsumer

        public org.apache.camel.Consumer createConsumer​(org.apache.camel.Processor processor)
                                                 throws Exception
        Throws:
        Exception
      • getComponent

        public ControlBusComponent getComponent()
        Overrides:
        getComponent in class org.apache.camel.support.DefaultEndpoint
      • getLanguage

        public org.apache.camel.spi.Language getLanguage()
      • setLanguage

        public void setLanguage​(org.apache.camel.spi.Language language)
        Allows you to specify the name of a Language to use for evaluating the message body. If there is any result from the evaluation, then the result is put in the message body.
      • getRouteId

        public String getRouteId()
      • setRouteId

        public void setRouteId​(String routeId)
        To specify a route by its id. The special keyword "current" indicates the current route.
      • getAction

        public String getAction()
      • setAction

        public void setAction​(String action)
        To denote an action that can be either: start, stop, or status.

        To either start or stop a route, or to get the status of the route as output in the message body. You can use suspend and resume from Camel 2.11.1 onwards to either suspend or resume a route. And from Camel 2.11.1 onwards you can use stats to get performance statics returned in XML format; the routeId option can be used to define which route to get the performance stats for, if routeId is not defined, then you get statistics for the entire CamelContext. The restart action will restart the route.

      • getRestartDelay

        public int getRestartDelay()
      • setRestartDelay

        public void setRestartDelay​(int restartDelay)
        The delay in millis to use when restarting a route.
      • isAsync

        public boolean isAsync()
      • setAsync

        public void setAsync​(boolean async)
        Whether to execute the control bus task asynchronously.

        Important: If this option is enabled, then any result from the task is not set on the Exchange. This is only possible if executing tasks synchronously.

      • getLoggingLevel

        public org.apache.camel.LoggingLevel getLoggingLevel()
      • setLoggingLevel

        public void setLoggingLevel​(org.apache.camel.LoggingLevel loggingLevel)
        Logging level used for logging when task is done, or if any exceptions occurred during processing the task.