Class DefaultRoute

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.impl.engine.DefaultRoute
All Implemented Interfaces:
AutoCloseable, org.apache.camel.Route, org.apache.camel.RuntimeConfiguration, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

public class DefaultRoute extends org.apache.camel.support.service.ServiceSupport implements org.apache.camel.Route
Default implementation of Route.

Use the API from CamelContext to control the lifecycle of a route, such as starting and stopping using the RouteController.startRoute(String) and RouteController.stopRoute(String) methods.

  • Constructor Details

    • DefaultRoute

      public DefaultRoute(org.apache.camel.CamelContext camelContext, org.apache.camel.NamedNode route, String routeId, String routeDescription, org.apache.camel.Endpoint endpoint, org.apache.camel.spi.Resource resource)
  • Method Details

    • getId

      public String getId()
      Specified by:
      getId in interface org.apache.camel.Route
    • getNodePrefixId

      public String getNodePrefixId()
      Specified by:
      getNodePrefixId in interface org.apache.camel.Route
    • isCustomId

      public boolean isCustomId()
      Specified by:
      isCustomId in interface org.apache.camel.Route
    • isCreatedByRestDsl

      public boolean isCreatedByRestDsl()
      Specified by:
      isCreatedByRestDsl in interface org.apache.camel.Route
    • isCreatedByRouteTemplate

      public boolean isCreatedByRouteTemplate()
      Specified by:
      isCreatedByRouteTemplate in interface org.apache.camel.Route
    • isCreatedByKamelet

      public boolean isCreatedByKamelet()
      Specified by:
      isCreatedByKamelet in interface org.apache.camel.Route
    • getGroup

      public String getGroup()
      Specified by:
      getGroup in interface org.apache.camel.Route
    • getUptime

      public String getUptime()
      Specified by:
      getUptime in interface org.apache.camel.Route
    • getUptimeMillis

      public long getUptimeMillis()
      Specified by:
      getUptimeMillis in interface org.apache.camel.Route
    • getEndpoint

      public org.apache.camel.Endpoint getEndpoint()
      Specified by:
      getEndpoint in interface org.apache.camel.Route
    • getCamelContext

      public org.apache.camel.CamelContext getCamelContext()
      Specified by:
      getCamelContext in interface org.apache.camel.Route
    • getProperties

      public Map<String,Object> getProperties()
      Specified by:
      getProperties in interface org.apache.camel.Route
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface org.apache.camel.Route
    • getConfigurationId

      public String getConfigurationId()
      Specified by:
      getConfigurationId in interface org.apache.camel.Route
    • getSourceResource

      public org.apache.camel.spi.Resource getSourceResource()
      Specified by:
      getSourceResource in interface org.apache.camel.Route
    • getSourceLocation

      public String getSourceLocation()
      Specified by:
      getSourceLocation in interface org.apache.camel.Route
    • getSourceLocationShort

      public String getSourceLocationShort()
      Specified by:
      getSourceLocationShort in interface org.apache.camel.Route
    • initializeServices

      public void initializeServices() throws Exception
      Specified by:
      initializeServices in interface org.apache.camel.Route
      Throws:
      Exception
    • getServices

      public List<org.apache.camel.Service> getServices()
      Specified by:
      getServices in interface org.apache.camel.Route
    • addService

      public void addService(org.apache.camel.Service service)
      Specified by:
      addService in interface org.apache.camel.Route
    • warmUp

      public void warmUp()
      Specified by:
      warmUp in interface org.apache.camel.Route
    • start

      public void start()
      Do not invoke this method directly, use RouteController.startRoute(String) to start a route.
      Specified by:
      start in interface org.apache.camel.Service
      Overrides:
      start in class org.apache.camel.support.service.BaseService
    • stop

      public void stop()
      Do not invoke this method directly, use RouteController.stopRoute(String) to stop a route.
      Specified by:
      stop in interface org.apache.camel.Service
      Overrides:
      stop in class org.apache.camel.support.service.BaseService
    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doShutdown

      protected void doShutdown() throws Exception
      Overrides:
      doShutdown in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • getLastError

      public org.apache.camel.spi.RouteError getLastError()
      Specified by:
      getLastError in interface org.apache.camel.Route
    • setLastError

      public void setLastError(org.apache.camel.spi.RouteError routeError)
      Specified by:
      setLastError in interface org.apache.camel.Route
    • getStartupOrder

      public Integer getStartupOrder()
      Specified by:
      getStartupOrder in interface org.apache.camel.Route
    • setStartupOrder

      public void setStartupOrder(Integer startupOrder)
      Specified by:
      setStartupOrder in interface org.apache.camel.Route
    • getRouteController

      public org.apache.camel.spi.RouteController getRouteController()
      Specified by:
      getRouteController in interface org.apache.camel.Route
    • setRouteController

      public void setRouteController(org.apache.camel.spi.RouteController routeController)
      Specified by:
      setRouteController in interface org.apache.camel.Route
    • isAutoStartup

      public Boolean isAutoStartup()
      Specified by:
      isAutoStartup in interface org.apache.camel.Route
      Specified by:
      isAutoStartup in interface org.apache.camel.RuntimeConfiguration
    • setAutoStartup

      public void setAutoStartup(Boolean autoStartup)
      Specified by:
      setAutoStartup in interface org.apache.camel.Route
      Specified by:
      setAutoStartup in interface org.apache.camel.RuntimeConfiguration
    • getRoute

      public org.apache.camel.NamedNode getRoute()
      Specified by:
      getRoute in interface org.apache.camel.Route
    • clearRouteModel

      public void clearRouteModel()
      Specified by:
      clearRouteModel in interface org.apache.camel.Route
    • getRouteId

      public String getRouteId()
      Specified by:
      getRouteId in interface org.apache.camel.Route
    • getRouteDescription

      public String getRouteDescription()
      Specified by:
      getRouteDescription in interface org.apache.camel.Route
    • getEventDrivenProcessors

      public List<org.apache.camel.Processor> getEventDrivenProcessors()
      Specified by:
      getEventDrivenProcessors in interface org.apache.camel.Route
    • getInterceptStrategies

      public List<org.apache.camel.spi.InterceptStrategy> getInterceptStrategies()
      Specified by:
      getInterceptStrategies in interface org.apache.camel.Route
    • setManagementInterceptStrategy

      public void setManagementInterceptStrategy(org.apache.camel.spi.ManagementInterceptStrategy interceptStrategy)
      Specified by:
      setManagementInterceptStrategy in interface org.apache.camel.Route
    • getManagementInterceptStrategy

      public org.apache.camel.spi.ManagementInterceptStrategy getManagementInterceptStrategy()
      Specified by:
      getManagementInterceptStrategy in interface org.apache.camel.Route
    • setTracing

      public void setTracing(Boolean tracing)
      Specified by:
      setTracing in interface org.apache.camel.RuntimeConfiguration
    • isTracing

      public Boolean isTracing()
      Specified by:
      isTracing in interface org.apache.camel.RuntimeConfiguration
    • getTracingPattern

      public String getTracingPattern()
      Specified by:
      getTracingPattern in interface org.apache.camel.RuntimeConfiguration
    • setTracingPattern

      public void setTracingPattern(String tracePattern)
      Specified by:
      setTracingPattern in interface org.apache.camel.RuntimeConfiguration
    • setBacklogTracing

      public void setBacklogTracing(Boolean backlogTrace)
      Specified by:
      setBacklogTracing in interface org.apache.camel.RuntimeConfiguration
    • isBacklogTracing

      public Boolean isBacklogTracing()
      Specified by:
      isBacklogTracing in interface org.apache.camel.RuntimeConfiguration
    • setDebugging

      public void setDebugging(Boolean debugging)
      Specified by:
      setDebugging in interface org.apache.camel.RuntimeConfiguration
    • isDebugging

      public Boolean isDebugging()
      Specified by:
      isDebugging in interface org.apache.camel.RuntimeConfiguration
    • setMessageHistory

      public void setMessageHistory(Boolean messageHistory)
      Specified by:
      setMessageHistory in interface org.apache.camel.RuntimeConfiguration
    • isMessageHistory

      public Boolean isMessageHistory()
      Specified by:
      isMessageHistory in interface org.apache.camel.RuntimeConfiguration
    • setLogMask

      public void setLogMask(Boolean logMask)
      Specified by:
      setLogMask in interface org.apache.camel.RuntimeConfiguration
    • isLogMask

      public Boolean isLogMask()
      Specified by:
      isLogMask in interface org.apache.camel.RuntimeConfiguration
    • setLogExhaustedMessageBody

      public void setLogExhaustedMessageBody(Boolean logExhaustedMessageBody)
      Specified by:
      setLogExhaustedMessageBody in interface org.apache.camel.RuntimeConfiguration
    • isLogExhaustedMessageBody

      public Boolean isLogExhaustedMessageBody()
      Specified by:
      isLogExhaustedMessageBody in interface org.apache.camel.RuntimeConfiguration
    • setStreamCaching

      public void setStreamCaching(Boolean cache)
      Specified by:
      setStreamCaching in interface org.apache.camel.RuntimeConfiguration
    • isStreamCaching

      public Boolean isStreamCaching()
      Specified by:
      isStreamCaching in interface org.apache.camel.RuntimeConfiguration
    • setDelayer

      public void setDelayer(Long delay)
      Specified by:
      setDelayer in interface org.apache.camel.RuntimeConfiguration
    • getDelayer

      public Long getDelayer()
      Specified by:
      getDelayer in interface org.apache.camel.RuntimeConfiguration
    • setErrorHandlerFactory

      public void setErrorHandlerFactory(org.apache.camel.ErrorHandlerFactory errorHandlerFactory)
      Specified by:
      setErrorHandlerFactory in interface org.apache.camel.Route
    • getErrorHandlerFactory

      public org.apache.camel.ErrorHandlerFactory getErrorHandlerFactory()
      Specified by:
      getErrorHandlerFactory in interface org.apache.camel.Route
    • setShutdownRoute

      public void setShutdownRoute(org.apache.camel.ShutdownRoute shutdownRoute)
      Specified by:
      setShutdownRoute in interface org.apache.camel.RuntimeConfiguration
    • setAllowUseOriginalMessage

      public void setAllowUseOriginalMessage(Boolean allowUseOriginalMessage)
      Specified by:
      setAllowUseOriginalMessage in interface org.apache.camel.RuntimeConfiguration
    • isAllowUseOriginalMessage

      public Boolean isAllowUseOriginalMessage()
      Specified by:
      isAllowUseOriginalMessage in interface org.apache.camel.RuntimeConfiguration
    • isCaseInsensitiveHeaders

      public Boolean isCaseInsensitiveHeaders()
      Specified by:
      isCaseInsensitiveHeaders in interface org.apache.camel.RuntimeConfiguration
    • setCaseInsensitiveHeaders

      public void setCaseInsensitiveHeaders(Boolean caseInsensitiveHeaders)
      Specified by:
      setCaseInsensitiveHeaders in interface org.apache.camel.RuntimeConfiguration
    • isAutowiredEnabled

      public Boolean isAutowiredEnabled()
      Specified by:
      isAutowiredEnabled in interface org.apache.camel.RuntimeConfiguration
    • setAutowiredEnabled

      public void setAutowiredEnabled(Boolean autowiredEnabled)
      Specified by:
      setAutowiredEnabled in interface org.apache.camel.RuntimeConfiguration
    • getShutdownRoute

      public org.apache.camel.ShutdownRoute getShutdownRoute()
      Specified by:
      getShutdownRoute in interface org.apache.camel.RuntimeConfiguration
    • setShutdownRunningTask

      public void setShutdownRunningTask(org.apache.camel.ShutdownRunningTask shutdownRunningTask)
      Specified by:
      setShutdownRunningTask in interface org.apache.camel.RuntimeConfiguration
    • getShutdownRunningTask

      public org.apache.camel.ShutdownRunningTask getShutdownRunningTask()
      Specified by:
      getShutdownRunningTask in interface org.apache.camel.RuntimeConfiguration
    • getRoutePolicyList

      public List<org.apache.camel.spi.RoutePolicy> getRoutePolicyList()
      Specified by:
      getRoutePolicyList in interface org.apache.camel.Route
    • getOnCompletions

      public Collection<org.apache.camel.Processor> getOnCompletions()
      Specified by:
      getOnCompletions in interface org.apache.camel.Route
    • setOnCompletion

      public void setOnCompletion(String onCompletionId, org.apache.camel.Processor processor)
      Specified by:
      setOnCompletion in interface org.apache.camel.Route
    • getOnExceptions

      public Collection<org.apache.camel.Processor> getOnExceptions()
      Specified by:
      getOnExceptions in interface org.apache.camel.Route
    • getOnException

      public org.apache.camel.Processor getOnException(String onExceptionId)
      Specified by:
      getOnException in interface org.apache.camel.Route
    • setOnException

      public void setOnException(String onExceptionId, org.apache.camel.Processor processor)
      Specified by:
      setOnException in interface org.apache.camel.Route
    • getErrorHandlers

      public Set<org.apache.camel.NamedNode> getErrorHandlers(org.apache.camel.ErrorHandlerFactory factory)
      Specified by:
      getErrorHandlers in interface org.apache.camel.Route
    • addErrorHandler

      public void addErrorHandler(org.apache.camel.ErrorHandlerFactory factory, org.apache.camel.NamedNode onException)
      Specified by:
      addErrorHandler in interface org.apache.camel.Route
    • addErrorHandlerFactoryReference

      public void addErrorHandlerFactoryReference(org.apache.camel.ErrorHandlerFactory source, org.apache.camel.ErrorHandlerFactory target)
      Specified by:
      addErrorHandlerFactoryReference in interface org.apache.camel.Route
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getProcessor

      public org.apache.camel.Processor getProcessor()
      Specified by:
      getProcessor in interface org.apache.camel.Route
    • setProcessor

      public void setProcessor(org.apache.camel.Processor processor)
      Specified by:
      setProcessor in interface org.apache.camel.Route
    • gatherServices

      protected void gatherServices(List<org.apache.camel.Service> services) throws Exception
      Factory method to lazily create the complete list of services required for this route such as adding the processor or consumer
      Throws:
      Exception
    • filter

      public List<org.apache.camel.Processor> filter(String pattern)
      Specified by:
      filter in interface org.apache.camel.Route
    • getConsumer

      public org.apache.camel.Consumer getConsumer()
      Specified by:
      getConsumer in interface org.apache.camel.Route
    • supportsSuspension

      public boolean supportsSuspension()
      Specified by:
      supportsSuspension in interface org.apache.camel.Route
    • setResumeStrategy

      public void setResumeStrategy(org.apache.camel.resume.ResumeStrategy resumeStrategy)
      Specified by:
      setResumeStrategy in interface org.apache.camel.Route
    • setConsumerListener

      public void setConsumerListener(org.apache.camel.resume.ConsumerListener<?,?> consumerListener)
      Specified by:
      setConsumerListener in interface org.apache.camel.Route