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 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.- See Also:
DefaultRouteController
-
-
Constructor Summary
Constructors Constructor Description DefaultSupervisingRouteController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doInit()
protected void
doStart()
protected void
doStop()
protected org.apache.camel.util.backoff.BackOff
getBackOff(String id)
long
getBackOffDelay()
long
getBackOffMaxAttempts()
long
getBackOffMaxDelay()
long
getBackOffMaxElapsedTime()
double
getBackOffMultiplier()
Collection<org.apache.camel.Route>
getControlledRoutes()
String
getExcludeRoutes()
Collection<org.apache.camel.Route>
getExhaustedRoutes()
String
getIncludeRoutes()
long
getInitialDelay()
Throwable
getRestartException(String routeId)
Collection<org.apache.camel.Route>
getRestartingRoutes()
org.apache.camel.util.backoff.BackOffTimer.Task
getRestartingRouteState(String routeId)
int
getThreadPoolSize()
boolean
isUnhealthyOnExhausted()
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
startRoute(String routeId)
void
stopRoute(String routeId)
void
stopRoute(String routeId, long timeout, TimeUnit timeUnit)
boolean
stopRoute(String routeId, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout)
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, getRouteStartupLoggingLevel, getRouteStatus, isStartingRoutes, setCamelContext, setRouteStartupLoggingLevel, startAllRoutes, 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, getRouteStartupLoggingLevel, getRouteStatus, isStartingRoutes, setRouteStartupLoggingLevel, startAllRoutes, supervising
-
-
-
-
Method Detail
-
getIncludeRoutes
public String getIncludeRoutes()
- Specified by:
getIncludeRoutes
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setIncludeRoutes
public void setIncludeRoutes(String includeRoutes)
- Specified by:
setIncludeRoutes
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getExcludeRoutes
public String getExcludeRoutes()
- Specified by:
getExcludeRoutes
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
setExcludeRoutes
public void setExcludeRoutes(String excludeRoutes)
- 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
-
getBackOff
protected org.apache.camel.util.backoff.BackOff getBackOff(String id)
-
doInit
protected void doInit() throws Exception
- Overrides:
doInit
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStart
protected void doStart() throws Exception
- Overrides:
doStart
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStop
protected void doStop() throws Exception
- Overrides:
doStop
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
startRoute
public void startRoute(String routeId) throws Exception
- Specified by:
startRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
startRoute
in classDefaultRouteController
- Throws:
Exception
-
stopRoute
public void stopRoute(String routeId) throws Exception
- Specified by:
stopRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
stopRoute
in classDefaultRouteController
- Throws:
Exception
-
stopRoute
public void stopRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception
- 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
public void suspendRoute(String routeId) throws Exception
- Specified by:
suspendRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
suspendRoute
in classDefaultRouteController
- Throws:
Exception
-
suspendRoute
public void suspendRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception
- Specified by:
suspendRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
suspendRoute
in classDefaultRouteController
- Throws:
Exception
-
resumeRoute
public void resumeRoute(String routeId) throws Exception
- Specified by:
resumeRoute
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
resumeRoute
in classDefaultRouteController
- Throws:
Exception
-
getControlledRoutes
public Collection<org.apache.camel.Route> getControlledRoutes()
- Specified by:
getControlledRoutes
in interfaceorg.apache.camel.spi.RouteController
- Overrides:
getControlledRoutes
in classDefaultRouteController
-
getRestartingRoutes
public Collection<org.apache.camel.Route> getRestartingRoutes()
- Specified by:
getRestartingRoutes
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getExhaustedRoutes
public Collection<org.apache.camel.Route> getExhaustedRoutes()
- Specified by:
getExhaustedRoutes
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
getRestartingRouteState
public org.apache.camel.util.backoff.BackOffTimer.Task getRestartingRouteState(String routeId)
- Specified by:
getRestartingRouteState
in interfaceorg.apache.camel.spi.SupervisingRouteController
-
-