Package org.apache.camel.spi
Interface SupervisingRouteController
-
- All Superinterfaces:
AutoCloseable
,CamelContextAware
,RouteController
,Service
,StaticService
public interface SupervisingRouteController extends RouteController
A supervising capableRouteController
that delays the startup of the routes after the camel context startup and takes control of starting the routes in a safe manner. This controller is able to retry starting failing routes, and have various options to configure settings for backoff between restarting routes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getBackOffDelay()
long
getBackOffMaxAttempts()
long
getBackOffMaxDelay()
long
getBackOffMaxElapsedTime()
double
getBackOffMultiplier()
String
getExcludeRoutes()
Collection<Route>
getExhaustedRoutes()
Return the list of routes that have failed all attempts to startup and are now exhausted.String
getIncludeRoutes()
long
getInitialDelay()
Set<String>
getNonControlledRouteIds()
Returns the route ids of routes which are non controlled (such as routes that was excluded)Throwable
getRestartException(String routeId)
Gets the last exception that caused the route to not startup for the given routeCollection<Route>
getRestartingRoutes()
Return the list of routes that are currently under restarting by this controller.org.apache.camel.util.backoff.BackOffTimer.Task
getRestartingRouteState(String routeId)
Gets the state of the backoff for the given route if its managed and under restarting.int
getThreadPoolSize()
boolean
isUnhealthyOnExhausted()
Whether to mark the route as unhealthy (down) when all restarting attempts (backoff) have failed and the route is not successfully started and the route manager is giving up.void
setBackOffDelay(long backOffDelay)
Backoff delay in millis when restarting a route that failed to startup.void
setBackOffMaxAttempts(long backOffMaxAttempts)
Backoff maximum number of attempts to restart a route that failed to startup.void
setBackOffMaxDelay(long backOffMaxDelay)
Backoff maximum delay in millis when restarting a route that failed to startup.void
setBackOffMaxElapsedTime(long backOffMaxElapsedTime)
Backoff maximum elapsed time in millis, after which the backoff should be considered exhausted and no more attempts should be made.void
setBackOffMultiplier(double backOffMultiplier)
Backoff multiplier to use for exponential backoff.void
setExcludeRoutes(String excludeRoutes)
Pattern for filtering routes to be excluded as supervised.void
setIncludeRoutes(String includeRoutes)
Pattern for filtering routes to be included as supervised.void
setInitialDelay(long initialDelay)
Initial delay in milli seconds before the route controller starts, after CamelContext has been started.void
setThreadPoolSize(int threadPoolSize)
The number of threads used by the scheduled thread pool that are used for restarting routes.void
setUnhealthyOnExhausted(boolean unhealthyOnExhausted)
Whether to mark the route as unhealthy (down) when all restarting attempts (backoff) have failed and the route is not successfully started and the route manager is giving up.-
Methods inherited from interface org.apache.camel.CamelContextAware
getCamelContext, setCamelContext
-
Methods inherited from interface org.apache.camel.spi.RouteController
adapt, getControlledRoutes, getLoggingLevel, getRouteStatus, isReloadingRoutes, isStartingRoutes, isSupervising, reloadAllRoutes, removeAllRoutes, resumeRoute, setLoggingLevel, startAllRoutes, startRoute, stopAllRoutes, stopRoute, stopRoute, stopRoute, stopRoute, supervising, suspendRoute, suspendRoute
-
-
-
-
Method Detail
-
getIncludeRoutes
String getIncludeRoutes()
-
setIncludeRoutes
void setIncludeRoutes(String includeRoutes)
Pattern for filtering routes to be included as supervised. The pattern is matching on route id, and endpoint uri for the route. Multiple patterns can be separated by comma. For example to include all kafka routes, you can say kafka:*. And to include routes with specific route ids myRoute,myOtherRoute. The pattern supports wildcards and uses the matcher from org.apache.camel.support.PatternHelper#matchPattern.
-
getExcludeRoutes
String getExcludeRoutes()
-
setExcludeRoutes
void setExcludeRoutes(String excludeRoutes)
Pattern for filtering routes to be excluded as supervised. The pattern is matching on route id, and endpoint uri for the route. Multiple patterns can be separated by comma. For example to exclude all JMS routes, you can say jms:*. And to exclude routes with specific route ids mySpecialRoute,myOtherSpecialRoute. The pattern supports wildcards and uses the matcher from org.apache.camel.support.PatternHelper#matchPattern.
-
getThreadPoolSize
int getThreadPoolSize()
-
setThreadPoolSize
void setThreadPoolSize(int threadPoolSize)
The number of threads used by the scheduled thread pool that are used for restarting routes. The pool uses 1 thread by default, but you can increase this to allow the controller to concurrently attempt to restart multiple routes in case more than one route has problems starting.
-
getInitialDelay
long getInitialDelay()
-
setInitialDelay
void setInitialDelay(long initialDelay)
Initial delay in milli seconds before the route controller starts, after CamelContext has been started.
-
getBackOffDelay
long getBackOffDelay()
-
setBackOffDelay
void setBackOffDelay(long backOffDelay)
Backoff delay in millis when restarting a route that failed to startup.
-
getBackOffMaxDelay
long getBackOffMaxDelay()
-
setBackOffMaxDelay
void setBackOffMaxDelay(long backOffMaxDelay)
Backoff maximum delay in millis when restarting a route that failed to startup.
-
getBackOffMaxElapsedTime
long getBackOffMaxElapsedTime()
-
setBackOffMaxElapsedTime
void setBackOffMaxElapsedTime(long backOffMaxElapsedTime)
Backoff maximum elapsed time in millis, after which the backoff should be considered exhausted and no more attempts should be made.
-
getBackOffMaxAttempts
long getBackOffMaxAttempts()
-
setBackOffMaxAttempts
void setBackOffMaxAttempts(long backOffMaxAttempts)
Backoff maximum number of attempts to restart a route that failed to startup. When this threshold has been exceeded then the controller will give up attempting to restart the route, and the route will remain as stopped.
-
getBackOffMultiplier
double getBackOffMultiplier()
-
setBackOffMultiplier
void setBackOffMultiplier(double backOffMultiplier)
Backoff multiplier to use for exponential backoff. This is used to extend the delay between restart attempts.
-
setUnhealthyOnExhausted
void setUnhealthyOnExhausted(boolean unhealthyOnExhausted)
Whether to mark the route as unhealthy (down) when all restarting attempts (backoff) have failed and the route is not successfully started and the route manager is giving up. Setting this to true allows health checks to know about this and can report the Camel application as DOWN. The default is false.
-
isUnhealthyOnExhausted
boolean isUnhealthyOnExhausted()
Whether to mark the route as unhealthy (down) when all restarting attempts (backoff) have failed and the route is not successfully started and the route manager is giving up. Setting this to true allows health checks to know about this and can report the Camel application as DOWN. The default is false.
-
getRestartingRoutes
Collection<Route> getRestartingRoutes()
Return the list of routes that are currently under restarting by this controller. In other words the routes which has failed during startup and are know managed to be restarted.
-
getExhaustedRoutes
Collection<Route> getExhaustedRoutes()
Return the list of routes that have failed all attempts to startup and are now exhausted.
-
getNonControlledRouteIds
Set<String> getNonControlledRouteIds()
Returns the route ids of routes which are non controlled (such as routes that was excluded)
-
getRestartingRouteState
org.apache.camel.util.backoff.BackOffTimer.Task getRestartingRouteState(String routeId)
Gets the state of the backoff for the given route if its managed and under restarting.- Parameters:
routeId
- the route id- Returns:
- the state, or null if the route is not under restarting
-
-