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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoInit()protected voiddoStart()protected voiddoStop()protected org.apache.camel.util.backoff.BackOffgetBackOff(String id) longlonglonglongdoubleCollection<org.apache.camel.Route> Collection<org.apache.camel.Route> longgetRestartException(String routeId) Collection<org.apache.camel.Route> org.apache.camel.util.backoff.BackOffTimer.TaskgetRestartingRouteState(String routeId) intbooleanbooleanbooleanbooleanvoidresumeRoute(String routeId) voidsetBackOffDelay(long backOffDelay) voidsetBackOffMaxAttempts(long backOffMaxAttempts) voidsetBackOffMaxDelay(long backOffMaxDelay) voidsetBackOffMaxElapsedTime(long backOffMaxElapsedTime) voidsetBackOffMultiplier(double backOffMultiplier) voidsetExcludeRoutes(String excludeRoutes) voidsetIncludeRoutes(String includeRoutes) voidsetInitialDelay(long initialDelay) voidsetThreadPoolSize(int threadPoolSize) voidsetUnhealthyOnExhausted(boolean unhealthyOnExhausted) voidsetUnhealthyOnRestarting(boolean unhealthyOnRestarting) voidstartRoute(String routeId) voidstartRoutes(boolean reloaded) voidvoidbooleanvoidvoidsuspendRoute(String routeId) voidsuspendRoute(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, supervisingMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.CamelContextAware
setCamelContextMethods inherited from interface org.apache.camel.spi.HasCamelContext
getCamelContextMethods inherited from interface org.apache.camel.spi.RouteController
adapt, getLoggingLevel, getRouteStatus, isReloadingRoutes, isSupervising, reloadAllRoutes, removeAllRoutes, setLoggingLevel, startAllRoutes, stopAllRoutes, supervisingMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.spi.SupervisingRouteController
startRoutesMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
DefaultSupervisingRouteController
public DefaultSupervisingRouteController()
-
-
Method Details
-
startRoutes
public void startRoutes(boolean reloaded) - Specified by:
startRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getIncludeRoutes
- Specified by:
getIncludeRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController
-
setIncludeRoutes
- Specified by:
setIncludeRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getExcludeRoutes
- Specified by:
getExcludeRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController
-
setExcludeRoutes
- Specified by:
setExcludeRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getThreadPoolSize
public int getThreadPoolSize()- Specified by:
getThreadPoolSizein interfaceorg.apache.camel.spi.SupervisingRouteController
-
setThreadPoolSize
public void setThreadPoolSize(int threadPoolSize) - Specified by:
setThreadPoolSizein interfaceorg.apache.camel.spi.SupervisingRouteController
-
getInitialDelay
public long getInitialDelay()- Specified by:
getInitialDelayin interfaceorg.apache.camel.spi.SupervisingRouteController
-
setInitialDelay
public void setInitialDelay(long initialDelay) - Specified by:
setInitialDelayin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getBackOffDelay
public long getBackOffDelay()- Specified by:
getBackOffDelayin interfaceorg.apache.camel.spi.SupervisingRouteController
-
setBackOffDelay
public void setBackOffDelay(long backOffDelay) - Specified by:
setBackOffDelayin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getBackOffMaxDelay
public long getBackOffMaxDelay()- Specified by:
getBackOffMaxDelayin interfaceorg.apache.camel.spi.SupervisingRouteController
-
setBackOffMaxDelay
public void setBackOffMaxDelay(long backOffMaxDelay) - Specified by:
setBackOffMaxDelayin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getBackOffMaxElapsedTime
public long getBackOffMaxElapsedTime()- Specified by:
getBackOffMaxElapsedTimein interfaceorg.apache.camel.spi.SupervisingRouteController
-
setBackOffMaxElapsedTime
public void setBackOffMaxElapsedTime(long backOffMaxElapsedTime) - Specified by:
setBackOffMaxElapsedTimein interfaceorg.apache.camel.spi.SupervisingRouteController
-
getBackOffMaxAttempts
public long getBackOffMaxAttempts()- Specified by:
getBackOffMaxAttemptsin interfaceorg.apache.camel.spi.SupervisingRouteController
-
setBackOffMaxAttempts
public void setBackOffMaxAttempts(long backOffMaxAttempts) - Specified by:
setBackOffMaxAttemptsin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getBackOffMultiplier
public double getBackOffMultiplier()- Specified by:
getBackOffMultiplierin interfaceorg.apache.camel.spi.SupervisingRouteController
-
setBackOffMultiplier
public void setBackOffMultiplier(double backOffMultiplier) - Specified by:
setBackOffMultiplierin interfaceorg.apache.camel.spi.SupervisingRouteController
-
isUnhealthyOnExhausted
public boolean isUnhealthyOnExhausted()- Specified by:
isUnhealthyOnExhaustedin interfaceorg.apache.camel.spi.SupervisingRouteController
-
setUnhealthyOnExhausted
public void setUnhealthyOnExhausted(boolean unhealthyOnExhausted) - Specified by:
setUnhealthyOnExhaustedin interfaceorg.apache.camel.spi.SupervisingRouteController
-
isUnhealthyOnRestarting
public boolean isUnhealthyOnRestarting()- Specified by:
isUnhealthyOnRestartingin interfaceorg.apache.camel.spi.SupervisingRouteController
-
setUnhealthyOnRestarting
public void setUnhealthyOnRestarting(boolean unhealthyOnRestarting) - Specified by:
setUnhealthyOnRestartingin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getBackOff
-
doInit
- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
hasUnhealthyRoutes
public boolean hasUnhealthyRoutes()- Specified by:
hasUnhealthyRoutesin interfaceorg.apache.camel.spi.RouteController- Overrides:
hasUnhealthyRoutesin classDefaultRouteController
-
isStartingRoutes
public boolean isStartingRoutes()- Specified by:
isStartingRoutesin interfaceorg.apache.camel.spi.RouteController- Specified by:
isStartingRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController- Overrides:
isStartingRoutesin classDefaultRouteController
-
startRoute
- Specified by:
startRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
startRoutein classDefaultRouteController- Throws:
Exception
-
stopRoute
- Specified by:
stopRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
stopRoutein classDefaultRouteController- Throws:
Exception
-
stopRoute
- Specified by:
stopRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
stopRoutein classDefaultRouteController- Throws:
Exception
-
stopRoute
- Specified by:
stopRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
stopRoutein classDefaultRouteController- Throws:
Exception
-
stopRoute
public boolean stopRoute(String routeId, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout) throws Exception - Specified by:
stopRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
stopRoutein classDefaultRouteController- Throws:
Exception
-
suspendRoute
- Specified by:
suspendRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
suspendRoutein classDefaultRouteController- Throws:
Exception
-
suspendRoute
- Specified by:
suspendRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
suspendRoutein classDefaultRouteController- Throws:
Exception
-
resumeRoute
- Specified by:
resumeRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
resumeRoutein classDefaultRouteController- Throws:
Exception
-
getControlledRoutes
- Specified by:
getControlledRoutesin interfaceorg.apache.camel.spi.RouteController- Overrides:
getControlledRoutesin classDefaultRouteController
-
getRestartingRoutes
- Specified by:
getRestartingRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getExhaustedRoutes
- Specified by:
getExhaustedRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getNonControlledRouteIds
- Specified by:
getNonControlledRouteIdsin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getRestartingRouteState
- Specified by:
getRestartingRouteStatein interfaceorg.apache.camel.spi.SupervisingRouteController
-
getRestartException
- Specified by:
getRestartExceptionin interfaceorg.apache.camel.spi.SupervisingRouteController
-