Package org.apache.camel
Interface Route
-
- All Superinterfaces:
RuntimeConfiguration
public interface Route extends RuntimeConfiguration
A Route defines the processing used on an inbound message exchange from a specificEndpointwithin aCamelContext. Use the API fromCamelContextto control the lifecycle of a route, such as starting and stopping using theRouteController.startRoute(String)andRouteController.stopRoute(String)methods.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONFIGURATION_ID_PROPERTYstatic StringCUSTOM_ID_PROPERTYstatic StringDESCRIPTION_PROPERTYstatic StringGROUP_PROPERTYstatic StringID_PROPERTYstatic StringPARENT_PROPERTYstatic StringREST_PROPERTYstatic StringSUPERVISEDstatic StringTEMPLATE_PROPERTY
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddErrorHandler(ErrorHandlerFactory factory, NamedNode exception)Adds error handler for the given exception typevoidaddErrorHandlerFactoryReference(ErrorHandlerFactory source, ErrorHandlerFactory target)Link the error handlers from a factory to anothervoidaddService(Service service)Adds a service to this routevoidclearRouteModel()Clears the route model when its no longer needed.List<Processor>filter(String pattern)Returns a list of all theProcessors from this route that has id's matching the patternCamelContextgetCamelContext()Gets the camel contextStringgetConfigurationId()Gets the route configuration id(s) the route has been applied with.ConsumergetConsumer()Gets the inboundConsumerStringgetDescription()Gets the route description (if any has been configured).EndpointgetEndpoint()Gets the input endpoint for this route.ErrorHandlerFactorygetErrorHandlerFactory()Set<NamedNode>getErrorHandlers(ErrorHandlerFactory factory)Gets the error handlersList<Processor>getEventDrivenProcessors()This method retrieves the event driven Processors on this route context.StringgetGroup()Gets the route groupStringgetId()Gets the route idList<InterceptStrategy>getInterceptStrategies()This method retrieves the InterceptStrategy instances this route context.RouteErrorgetLastError()Gets the last error that happened during changing the route lifecycle, i.e.ManagementInterceptStrategygetManagementInterceptStrategy()Gets the special managed intercept strategy if anyCollection<Processor>getOnCompletions()ProcessorgetOnException(String onExceptionId)Collection<Processor>getOnExceptions()ProcessorgetProcessor()Gets theProcessorMap<String,Object>getProperties()This property map is used to associate information about the route.NamedNodegetRoute()Get the route type.RouteControllergetRouteController()Gets theRouteControllerfor this route.StringgetRouteDescription()Gets the route descriptionStringgetRouteId()Gets the route idList<RoutePolicy>getRoutePolicyList()Gets the route policy ListList<Service>getServices()Returns the services for this particular routeStringgetSourceLocation()The source:line-number where the route input is located in the source codeStringgetSourceLocationShort()The source:line-number in short format that can be used for logging or summary purposes.ResourcegetSourceResource()Gets the source resource that this route is located fromIntegergetStartupOrder()Gets the route startup orderStringgetUptime()Gets the uptime in a human-readable formatlonggetUptimeMillis()Gets the uptime in millisecondsvoidinitializeServices()A strategy callback allowing special initialization when services are initializing.BooleanisAutoStartup()Gets whether the route should automatically start when Camel starts.booleanisCustomId()Whether the route id is custom assigned or auto assignedNavigate<Processor>navigate()Returns a navigator to navigate this route by navigating all theProcessors.voidsetAutoStartup(Boolean autoStartup)Sets whether the route should automatically start when Camel starts.voidsetConsumerListener(ConsumerListener<?,?> consumerListener)Sets the consumer listener for the routevoidsetErrorHandlerFactory(ErrorHandlerFactory errorHandlerFactory)voidsetLastError(RouteError error)Sets the last error that happened during changing the route lifecycle, i.e.voidsetManagementInterceptStrategy(ManagementInterceptStrategy interceptStrategy)Sets a special intercept strategy for management.voidsetOnCompletion(String onCompletionId, Processor processor)voidsetOnException(String onExceptionId, Processor processor)voidsetProcessor(Processor processor)Sets theProcessorvoidsetResumeStrategy(ResumeStrategy resumeStrategy)Sets the resume strategy for the routevoidsetRouteController(RouteController controller)Sets theRouteControllerfor this route.voidsetStartupOrder(Integer startupOrder)Sets the route startup orderbooleansupportsSuspension()Whether or not the route supports suspension (suspend and resume)voidwarmUp()Callback preparing the route to be started, by warming up the route.-
Methods inherited from interface org.apache.camel.RuntimeConfiguration
getDelayer, getShutdownRoute, getShutdownRunningTask, getTracingPattern, isAllowUseOriginalMessage, isAutowiredEnabled, isBacklogTracing, isCaseInsensitiveHeaders, isDebugging, isLogExhaustedMessageBody, isLogMask, isMessageHistory, isStreamCaching, isTracing, setAllowUseOriginalMessage, setAutowiredEnabled, setBacklogTracing, setCaseInsensitiveHeaders, setDebugging, setDelayer, setLogExhaustedMessageBody, setLogMask, setMessageHistory, setShutdownRoute, setShutdownRunningTask, setStreamCaching, setTracing, setTracingPattern
-
-
-
-
Field Detail
-
ID_PROPERTY
static final String ID_PROPERTY
- See Also:
- Constant Field Values
-
CUSTOM_ID_PROPERTY
static final String CUSTOM_ID_PROPERTY
- See Also:
- Constant Field Values
-
PARENT_PROPERTY
static final String PARENT_PROPERTY
- See Also:
- Constant Field Values
-
GROUP_PROPERTY
static final String GROUP_PROPERTY
- See Also:
- Constant Field Values
-
REST_PROPERTY
static final String REST_PROPERTY
- See Also:
- Constant Field Values
-
TEMPLATE_PROPERTY
static final String TEMPLATE_PROPERTY
- See Also:
- Constant Field Values
-
DESCRIPTION_PROPERTY
static final String DESCRIPTION_PROPERTY
- See Also:
- Constant Field Values
-
CONFIGURATION_ID_PROPERTY
static final String CONFIGURATION_ID_PROPERTY
- See Also:
- Constant Field Values
-
SUPERVISED
static final String SUPERVISED
- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
String getId()
Gets the route id- Returns:
- the route id
-
isCustomId
boolean isCustomId()
Whether the route id is custom assigned or auto assigned- Returns:
- true if custom id, false if auto assigned id
-
getGroup
String getGroup()
Gets the route group- Returns:
- the route group
-
getUptime
String getUptime()
Gets the uptime in a human-readable format- Returns:
- the uptime in days/hours/minutes
-
getUptimeMillis
long getUptimeMillis()
Gets the uptime in milliseconds- Returns:
- the uptime in milliseconds
-
supportsSuspension
boolean supportsSuspension()
Whether or not the route supports suspension (suspend and resume)- Returns:
- true if this route supports suspension
-
getProperties
Map<String,Object> getProperties()
This property map is used to associate information about the route.- Returns:
- properties
-
getDescription
String getDescription()
Gets the route description (if any has been configured). The description is configured using theDESCRIPTION_PROPERTYas key in thegetProperties().- Returns:
- the description, or null if no description has been configured.
-
getConfigurationId
String getConfigurationId()
Gets the route configuration id(s) the route has been applied with. Multiple ids is separated by comma. The configuration ids is configured using theCONFIGURATION_ID_PROPERTYas key in thegetProperties().- Returns:
- the configuration, or null if no configuration has been configured.
-
getSourceResource
Resource getSourceResource()
Gets the source resource that this route is located from- Returns:
- the source, or null if this route is not loaded from a resource
-
getSourceLocation
String getSourceLocation()
The source:line-number where the route input is located in the source code
-
getSourceLocationShort
String getSourceLocationShort()
The source:line-number in short format that can be used for logging or summary purposes.
-
getCamelContext
CamelContext getCamelContext()
Gets the camel context- Returns:
- the camel context
-
getEndpoint
Endpoint getEndpoint()
Gets the input endpoint for this route.- Returns:
- the endpoint
-
initializeServices
void initializeServices() throws ExceptionA strategy callback allowing special initialization when services are initializing.- Throws:
Exception- is thrown in case of error
-
getServices
List<Service> getServices()
Returns the services for this particular route- Returns:
- the services
-
addService
void addService(Service service)
Adds a service to this route- Parameters:
service- the service
-
navigate
Navigate<Processor> navigate()
Returns a navigator to navigate this route by navigating all theProcessors.- Returns:
- a navigator for
Processor.
-
filter
List<Processor> filter(String pattern)
Returns a list of all theProcessors from this route that has id's matching the pattern- Parameters:
pattern- the pattern to match by ids- Returns:
- a list of
Processor, is never null.
-
warmUp
void warmUp()
Callback preparing the route to be started, by warming up the route.
-
getLastError
RouteError getLastError()
Gets the last error that happened during changing the route lifecycle, i.e. such as when an exception was thrown during starting the route. This is only errors for route lifecycle changes, it is not exceptions thrown during routing exchanges by the Camel routing engine.- Returns:
- the error or null if no error
-
setLastError
void setLastError(RouteError error)
Sets the last error that happened during changing the route lifecycle, i.e. such as when an exception was thrown during starting the route. This is only errors for route lifecycle changes, it is not exceptions thrown during routing exchanges by the Camel routing engine.- Parameters:
error- the error
-
getStartupOrder
Integer getStartupOrder()
Gets the route startup order
-
setStartupOrder
void setStartupOrder(Integer startupOrder)
Sets the route startup order
-
getRouteController
RouteController getRouteController()
Gets theRouteControllerfor this route.- Returns:
- the route controller,
-
setRouteController
void setRouteController(RouteController controller)
Sets theRouteControllerfor this route.- Parameters:
controller- the RouteController
-
setAutoStartup
void setAutoStartup(Boolean autoStartup)
Sets whether the route should automatically start when Camel starts. Default is true to always start up.- Specified by:
setAutoStartupin interfaceRuntimeConfiguration- Parameters:
autoStartup- whether to start up automatically.
-
isAutoStartup
Boolean isAutoStartup()
Gets whether the route should automatically start when Camel starts. Default is true to always start up.- Specified by:
isAutoStartupin interfaceRuntimeConfiguration- Returns:
- true if route should automatically start
-
getRouteId
String getRouteId()
Gets the route id
-
getRouteDescription
String getRouteDescription()
Gets the route description
-
getRoute
NamedNode getRoute()
Get the route type. Important: is null after the route has been created.- Returns:
- the route type during creation of the route, is null after the route has been created.
-
clearRouteModel
void clearRouteModel()
Clears the route model when its no longer needed.
-
getEventDrivenProcessors
List<Processor> getEventDrivenProcessors()
This method retrieves the event driven Processors on this route context.
-
getInterceptStrategies
List<InterceptStrategy> getInterceptStrategies()
This method retrieves the InterceptStrategy instances this route context.- Returns:
- the strategy
-
setManagementInterceptStrategy
void setManagementInterceptStrategy(ManagementInterceptStrategy interceptStrategy)
Sets a special intercept strategy for management. Is by default used to correlate managed performance counters with processors when the runtime route is being constructed- Parameters:
interceptStrategy- the managed intercept strategy
-
getManagementInterceptStrategy
ManagementInterceptStrategy getManagementInterceptStrategy()
Gets the special managed intercept strategy if any- Returns:
- the managed intercept strategy, or null if not managed
-
getRoutePolicyList
List<RoutePolicy> getRoutePolicyList()
Gets the route policy List- Returns:
- the route policy list if any
-
setErrorHandlerFactory
void setErrorHandlerFactory(ErrorHandlerFactory errorHandlerFactory)
-
getErrorHandlerFactory
ErrorHandlerFactory getErrorHandlerFactory()
-
getOnCompletions
Collection<Processor> getOnCompletions()
-
getOnExceptions
Collection<Processor> getOnExceptions()
-
addErrorHandler
void addErrorHandler(ErrorHandlerFactory factory, NamedNode exception)
Adds error handler for the given exception type- Parameters:
factory- the error handler factoryexception- the exception to handle
-
getErrorHandlers
Set<NamedNode> getErrorHandlers(ErrorHandlerFactory factory)
Gets the error handlers- Parameters:
factory- the error handler factory
-
addErrorHandlerFactoryReference
void addErrorHandlerFactoryReference(ErrorHandlerFactory source, ErrorHandlerFactory target)
Link the error handlers from a factory to another- Parameters:
source- the source factorytarget- the target factory
-
setResumeStrategy
void setResumeStrategy(ResumeStrategy resumeStrategy)
Sets the resume strategy for the route
-
setConsumerListener
void setConsumerListener(ConsumerListener<?,?> consumerListener)
Sets the consumer listener for the route
-
-