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.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 capableRouteControllerthat 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:
DefaultRouteController
-
-
Constructor Summary
Constructors Constructor Description DefaultSupervisingRouteController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoInit()protected voiddoStart()protected voiddoStop()protected org.apache.camel.util.backoff.BackOffgetBackOff(String id)longgetBackOffDelay()longgetBackOffMaxAttempts()longgetBackOffMaxDelay()longgetBackOffMaxElapsedTime()doublegetBackOffMultiplier()Collection<org.apache.camel.Route>getControlledRoutes()StringgetExcludeRoutes()Collection<org.apache.camel.Route>getExhaustedRoutes()StringgetIncludeRoutes()longgetInitialDelay()Set<String>getNonControlledRouteIds()ThrowablegetRestartException(String routeId)Collection<org.apache.camel.Route>getRestartingRoutes()org.apache.camel.util.backoff.BackOffTimer.TaskgetRestartingRouteState(String routeId)intgetThreadPoolSize()booleanisUnhealthyOnExhausted()voidresumeRoute(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)voidstartRoute(String routeId)voidstopRoute(String routeId)voidstopRoute(String routeId, long timeout, TimeUnit timeUnit)booleanstopRoute(String routeId, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout)voidsuspendRoute(String routeId)voidsuspendRoute(String routeId, long timeout, TimeUnit timeUnit)-
Methods inherited from class org.apache.camel.impl.engine.DefaultRouteController
adapt, getCamelContext, getInternalRouteController, getLoggingLevel, getRouteStatus, isStartingRoutes, isSupervising, 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
getCamelContext, setCamelContext
-
Methods inherited from interface org.apache.camel.spi.RouteController
adapt, getLoggingLevel, getRouteStatus, isStartingRoutes, isSupervising, removeAllRoutes, setLoggingLevel, startAllRoutes, stopAllRoutes, supervising
-
-
-
-
Method Detail
-
getIncludeRoutes
public String getIncludeRoutes()
- Specified by:
getIncludeRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController
-
setIncludeRoutes
public void setIncludeRoutes(String includeRoutes)
- Specified by:
setIncludeRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getExcludeRoutes
public String getExcludeRoutes()
- Specified by:
getExcludeRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController
-
setExcludeRoutes
public void setExcludeRoutes(String excludeRoutes)
- 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
-
getBackOff
protected org.apache.camel.util.backoff.BackOff getBackOff(String id)
-
doInit
protected void doInit() throws Exception- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
startRoute
public void startRoute(String routeId) throws Exception
- Specified by:
startRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
startRoutein classDefaultRouteController- Throws:
Exception
-
stopRoute
public void stopRoute(String routeId) throws Exception
- Specified by:
stopRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
stopRoutein classDefaultRouteController- Throws:
Exception
-
stopRoute
public void stopRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception
- 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
public void suspendRoute(String routeId) throws Exception
- Specified by:
suspendRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
suspendRoutein classDefaultRouteController- Throws:
Exception
-
suspendRoute
public void suspendRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception
- Specified by:
suspendRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
suspendRoutein classDefaultRouteController- Throws:
Exception
-
resumeRoute
public void resumeRoute(String routeId) throws Exception
- Specified by:
resumeRoutein interfaceorg.apache.camel.spi.RouteController- Overrides:
resumeRoutein classDefaultRouteController- Throws:
Exception
-
getControlledRoutes
public Collection<org.apache.camel.Route> getControlledRoutes()
- Specified by:
getControlledRoutesin interfaceorg.apache.camel.spi.RouteController- Overrides:
getControlledRoutesin classDefaultRouteController
-
getRestartingRoutes
public Collection<org.apache.camel.Route> getRestartingRoutes()
- Specified by:
getRestartingRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getExhaustedRoutes
public Collection<org.apache.camel.Route> getExhaustedRoutes()
- Specified by:
getExhaustedRoutesin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getNonControlledRouteIds
public Set<String> getNonControlledRouteIds()
- Specified by:
getNonControlledRouteIdsin interfaceorg.apache.camel.spi.SupervisingRouteController
-
getRestartingRouteState
public org.apache.camel.util.backoff.BackOffTimer.Task getRestartingRouteState(String routeId)
- Specified by:
getRestartingRouteStatein interfaceorg.apache.camel.spi.SupervisingRouteController
-
-