Package org.apache.camel.impl.engine
Class DefaultSupervisingRouteController
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.impl.engine.DefaultRouteController
org.apache.camel.impl.engine.DefaultSupervisingRouteController
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.CamelContextAware
,org.apache.camel.NonManagedService
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.HasCamelContext
,org.apache.camel.spi.RouteController
,org.apache.camel.spi.SupervisingRouteController
,org.apache.camel.StatefulService
,org.apache.camel.StaticService
,org.apache.camel.SuspendableService
public class DefaultSupervisingRouteController
extends DefaultRouteController
implements org.apache.camel.spi.SupervisingRouteController
A supervising capable
RouteController
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.- See Also:
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doInit()
protected void
doStart()
protected void
doStop()
protected org.apache.camel.util.backoff.BackOff
getBackOff
(String id) long
long
long
long
double
Collection
<org.apache.camel.Route> Collection
<org.apache.camel.Route> long
getRestartException
(String routeId) Collection
<org.apache.camel.Route> org.apache.camel.util.backoff.BackOffTimer.Task
getRestartingRouteState
(String routeId) int
boolean
boolean
boolean
boolean
void
resumeRoute
(String routeId) void
setBackOffDelay
(long backOffDelay) void
setBackOffMaxAttempts
(long backOffMaxAttempts) void
setBackOffMaxDelay
(long backOffMaxDelay) void
setBackOffMaxElapsedTime
(long backOffMaxElapsedTime) void
setBackOffMultiplier
(double backOffMultiplier) void
setExcludeRoutes
(String excludeRoutes) void
setIncludeRoutes
(String includeRoutes) void
setInitialDelay
(long initialDelay) void
setThreadPoolSize
(int threadPoolSize) void
setUnhealthyOnExhausted
(boolean unhealthyOnExhausted) void
setUnhealthyOnRestarting
(boolean unhealthyOnRestarting) void
startRoute
(String routeId) void
void
boolean
void
void
suspendRoute
(String routeId) void
suspendRoute
(String routeId, long timeout, TimeUnit timeUnit) Methods inherited from class org.apache.camel.impl.engine.DefaultRouteController
adapt, getCamelContext, getInternalRouteController, getLoggingLevel, getRouteStatus, isReloadingRoutes, isSupervising, reloadAllRoutes, removeAllRoutes, setCamelContext, setLoggingLevel, startAllRoutes, stopAllRoutes, supervising
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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.camel.CamelContextAware
setCamelContext
Methods inherited from interface org.apache.camel.spi.HasCamelContext
getCamelContext
Methods inherited from interface org.apache.camel.spi.RouteController
adapt, getLoggingLevel, getRouteStatus, isReloadingRoutes, isSupervising, reloadAllRoutes, removeAllRoutes, setLoggingLevel, startAllRoutes, stopAllRoutes, supervising
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 Details
-
DefaultSupervisingRouteController
public DefaultSupervisingRouteController()
-
-
Method Details
-
getIncludeRoutes
- Specified by:
getIncludeRoutes
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setIncludeRoutes
- Specified by:
setIncludeRoutes
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getExcludeRoutes
- Specified by:
getExcludeRoutes
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setExcludeRoutes
- Specified by:
setExcludeRoutes
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getThreadPoolSize
public int getThreadPoolSize()- Specified by:
getThreadPoolSize
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setThreadPoolSize
public void setThreadPoolSize(int threadPoolSize) - Specified by:
setThreadPoolSize
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getInitialDelay
public long getInitialDelay()- Specified by:
getInitialDelay
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setInitialDelay
public void setInitialDelay(long initialDelay) - Specified by:
setInitialDelay
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getBackOffDelay
public long getBackOffDelay()- Specified by:
getBackOffDelay
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setBackOffDelay
public void setBackOffDelay(long backOffDelay) - Specified by:
setBackOffDelay
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getBackOffMaxDelay
public long getBackOffMaxDelay()- Specified by:
getBackOffMaxDelay
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setBackOffMaxDelay
public void setBackOffMaxDelay(long backOffMaxDelay) - Specified by:
setBackOffMaxDelay
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getBackOffMaxElapsedTime
public long getBackOffMaxElapsedTime()- Specified by:
getBackOffMaxElapsedTime
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setBackOffMaxElapsedTime
public void setBackOffMaxElapsedTime(long backOffMaxElapsedTime) - Specified by:
setBackOffMaxElapsedTime
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getBackOffMaxAttempts
public long getBackOffMaxAttempts()- Specified by:
getBackOffMaxAttempts
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setBackOffMaxAttempts
public void setBackOffMaxAttempts(long backOffMaxAttempts) - Specified by:
setBackOffMaxAttempts
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getBackOffMultiplier
public double getBackOffMultiplier()- Specified by:
getBackOffMultiplier
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setBackOffMultiplier
public void setBackOffMultiplier(double backOffMultiplier) - Specified by:
setBackOffMultiplier
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
isUnhealthyOnExhausted
public boolean isUnhealthyOnExhausted()- Specified by:
isUnhealthyOnExhausted
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setUnhealthyOnExhausted
public void setUnhealthyOnExhausted(boolean unhealthyOnExhausted) - Specified by:
setUnhealthyOnExhausted
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
isUnhealthyOnRestarting
public boolean isUnhealthyOnRestarting()- Specified by:
isUnhealthyOnRestarting
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setUnhealthyOnRestarting
public void setUnhealthyOnRestarting(boolean unhealthyOnRestarting) - Specified by:
setUnhealthyOnRestarting
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getBackOff
-
doInit
- Overrides:
doInit
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStart
- Overrides:
doStart
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStop
- Overrides:
doStop
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
hasUnhealthyRoutes
public boolean hasUnhealthyRoutes()- Specified by:
hasUnhealthyRoutes
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
hasUnhealthyRoutes
in classDefaultRouteController
-
isStartingRoutes
public boolean isStartingRoutes()- Specified by:
isStartingRoutes
in interfaceorg.apache.camel.spi.RouteController
- Specified by:
isStartingRoutes
in interfaceorg.apache.camel.spi.SupervisingRouteController
- Overrides:
isStartingRoutes
in classDefaultRouteController
-
startRoute
- Specified by:
startRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
startRoute
in classDefaultRouteController
- Throws:
Exception
-
stopRoute
- Specified by:
stopRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
stopRoute
in classDefaultRouteController
- Throws:
Exception
-
stopRoute
- Specified by:
stopRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
stopRoute
in classDefaultRouteController
- Throws:
Exception
-
stopRoute
- Specified by:
stopRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
stopRoute
in classDefaultRouteController
- Throws:
Exception
-
stopRoute
public boolean stopRoute(String routeId, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout) throws Exception - Specified by:
stopRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
stopRoute
in classDefaultRouteController
- Throws:
Exception
-
suspendRoute
- Specified by:
suspendRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
suspendRoute
in classDefaultRouteController
- Throws:
Exception
-
suspendRoute
- Specified by:
suspendRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
suspendRoute
in classDefaultRouteController
- Throws:
Exception
-
resumeRoute
- Specified by:
resumeRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
resumeRoute
in classDefaultRouteController
- Throws:
Exception
-
getControlledRoutes
- Specified by:
getControlledRoutes
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
getControlledRoutes
in classDefaultRouteController
-
getRestartingRoutes
- Specified by:
getRestartingRoutes
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getExhaustedRoutes
- Specified by:
getExhaustedRoutes
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getNonControlledRouteIds
- Specified by:
getNonControlledRouteIds
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getRestartingRouteState
- Specified by:
getRestartingRouteState
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getRestartException
- Specified by:
getRestartException
in interfaceorg.apache.camel.spi.SupervisingRouteController
-