Interface Route
- All Superinterfaces:
RuntimeConfiguration
A Route defines the processing applied to an inbound
Exchange arriving at a specific Endpoint within a CamelContext.
Each route has a unique id, an input Endpoint, and a chain of Processors that transform or route the
exchange. Routes are built using a DSL (RoutesBuilder, RouteBuilder in Java DSL, YAML DSL, XML DSL)
and are registered in the CamelContext at startup.
The lifecycle of a route (start, stop, suspend, resume) is managed through the
RouteController. A route can also carry optional
RoutePolicy objects that apply governance rules such as throttling or scheduling.- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddErrorHandler(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 routevoidaddService(Service service, boolean forceStop) Adds a service to this routevoidClears the route model when its no longer needed.Returns a list of all theProcessors from this route that has id's matching the patternGets the camel context@Nullable StringGets the route configuration id(s) the route has been applied with.Gets the inboundConsumer@Nullable StringGets the route description (if any has been configured).Gets the input endpoint for this route.Gets the error handler factory for this route.getErrorHandlers(ErrorHandlerFactory factory) Gets the error handlersThis method retrieves the event driven Processors on this route context.@Nullable StringgetGroup()Gets the route groupgetId()Gets the route idThis method retrieves the InterceptStrategy instances this route context.@Nullable RouteErrorGets the last error that happened during changing the route lifecycle, i.e. such as when an exception was thrown during starting the route.@Nullable ManagementInterceptStrategyGets the special managed intercept strategy if any@Nullable StringGets the node prefix id@Nullable StringgetNote()Gets the route note (if any has been configured).Gets the on completion processors.@Nullable ProcessorgetOnException(String onExceptionId) Gets the on exception processor for the given id.Gets the on exception processors.Gets theProcessorThis property map is used to associate information about the route.@Nullable NamedNodegetRoute()Get the route type.Gets theRouteControllerfor this route.@Nullable StringGets the route descriptionGets the route id@Nullable StringGets the route noteGets the route policy ListReturns the services for this particular route@Nullable StringThe source:line-number where the route input is located in the source code@Nullable StringThe source:line-number in short format that can be used for logging or summary purposes.@Nullable ResourceGets the source resource that this route is located from@Nullable IntegerGets the route startup orderGets the uptime in a human-readable formatlongGets the uptime in millisecondsvoidA strategy callback allowing special initialization when services are initializing.Gets whether the route should automatically start when Camel starts.booleanWhether this route was created from a Kamelet.booleanWhether this route is a Rest DSL route.booleanWhether this route was created from a route template (or a Kamelet).booleanWhether the route id is custom assigned or auto assignednavigate()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) Sets the error handler factory for this route.voidsetLastError(@Nullable 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.voidsetManagementInterceptStrategy(ManagementInterceptStrategy interceptStrategy) Sets a special intercept strategy for management.voidsetOnCompletion(String onCompletionId, Processor processor) Sets an on completion processor.voidsetOnException(String onExceptionId, Processor processor) Sets an on exception processor.voidsetProcessor(Processor processor) Sets theProcessorvoidsetResumeStrategy(ResumeStrategy resumeStrategy) Sets the resume strategy for the routevoidsetRouteController(RouteController controller) Sets theRouteControllerfor this route.voidsetStartupOrder(@Nullable Integer startupOrder) Sets the route startup orderbooleanWhether 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 RuntimeConfiguration
getDelayer, getShutdownRoute, getShutdownRunningTask, getTracingPattern, isAllowUseOriginalMessage, isAutowiredEnabled, isBacklogTracing, isCaseInsensitiveHeaders, isDebugging, isLogExhaustedMessageBody, isLogMask, isMessageHistory, isMessageSize, isStreamCaching, isTracing, setAllowUseOriginalMessage, setAutowiredEnabled, setBacklogTracing, setCaseInsensitiveHeaders, setDebugging, setDelayer, setLogExhaustedMessageBody, setLogMask, setMessageHistory, setMessageSize, setShutdownRoute, setShutdownRunningTask, setStreamCaching, setTracing, setTracingPattern
-
Field Details
-
ID_PROPERTY
- See Also:
-
CUSTOM_ID_PROPERTY
- See Also:
-
PARENT_PROPERTY
- See Also:
-
GROUP_PROPERTY
- See Also:
-
NODE_PREFIX_ID_PROPERTY
- See Also:
-
REST_PROPERTY
- See Also:
-
TEMPLATE_PROPERTY
- See Also:
-
KAMELET_PROPERTY
- See Also:
-
DESCRIPTION_PROPERTY
- See Also:
-
NOTE_PROPERTY
- See Also:
-
CONFIGURATION_ID_PROPERTY
- See Also:
-
SUPERVISED
- See Also:
-
-
Method Details
-
getId
-
getNodePrefixId
@Nullable String getNodePrefixId()Gets the node prefix id -
isCustomId
boolean isCustomId()Whether the route id is custom assigned or auto assigned- Returns:
- true if custom id, false if auto assigned id
-
isCreatedByRestDsl
boolean isCreatedByRestDsl()Whether this route is a Rest DSL route. -
isCreatedByRouteTemplate
boolean isCreatedByRouteTemplate()Whether this route was created from a route template (or a Kamelet). -
isCreatedByKamelet
boolean isCreatedByKamelet()Whether this route was created from a Kamelet. -
getGroup
-
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
-
getConsumer
-
getProcessor
-
setProcessor
-
supportsSuspension
boolean supportsSuspension()Whether or not the route supports suspension (suspend and resume)- Returns:
- true if this route supports suspension
-
getProperties
-
getDescription
@Nullable 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.
-
getNote
@Nullable String getNote()Gets the route note (if any has been configured). The note is configured using theNOTE_PROPERTYas key in thegetProperties().- Returns:
- the note, or null if no note has been configured.
-
getConfigurationId
@Nullable 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
@Nullable 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
@Nullable String getSourceLocation()The source:line-number where the route input is located in the source code -
getSourceLocationShort
@Nullable String getSourceLocationShort()The source:line-number in short format that can be used for logging or summary purposes. -
getCamelContext
-
getEndpoint
-
initializeServices
-
getServices
-
addService
-
addService
Adds a service to this route- Parameters:
service- the serviceforceStop- whether to force stopping the service when the route stops
-
filter
-
warmUp
void warmUp()Callback preparing the route to be started, by warming up the route. -
getLastError
@Nullable 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
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
@Nullable Integer getStartupOrder()Gets the route startup order -
setStartupOrder
Sets the route startup order -
getRouteController
RouteController getRouteController()Gets theRouteControllerfor this route.- Returns:
- the route controller,
-
setRouteController
Sets theRouteControllerfor this route.- Parameters:
controller- the RouteController
-
setAutoStartup
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
@Nullable String getRouteDescription()Gets the route description -
getRouteNote
@Nullable String getRouteNote()Gets the route note -
getRoute
@Nullable 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
-
getInterceptStrategies
List<InterceptStrategy> getInterceptStrategies()This method retrieves the InterceptStrategy instances this route context.- Returns:
- the strategy
-
setManagementInterceptStrategy
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
@Nullable 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
Sets the error handler factory for this route. -
getErrorHandlerFactory
ErrorHandlerFactory getErrorHandlerFactory()Gets the error handler factory for this route. -
getOnCompletions
Collection<Processor> getOnCompletions()Gets the on completion processors. -
setOnCompletion
-
getOnExceptions
Collection<Processor> getOnExceptions()Gets the on exception processors. -
getOnException
-
setOnException
-
addErrorHandler
Adds error handler for the given exception type- Parameters:
factory- the error handler factoryexception- the exception to handle
-
getErrorHandlers
Gets the error handlers- Parameters:
factory- the error handler factory
-
addErrorHandlerFactoryReference
Link the error handlers from a factory to another- Parameters:
source- the source factorytarget- the target factory
-
setResumeStrategy
Sets the resume strategy for the route -
setConsumerListener
Sets the consumer listener for the route
-