public class SupervisingRouteController extends DefaultRouteController
RouteController
that delays the startup
of the routes after the camel context startup and retries to start failing routes.
NOTE: this is experimental/unstable.Modifier and Type | Class and Description |
---|---|
static interface |
SupervisingRouteController.Filter |
static class |
SupervisingRouteController.FilterResult |
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Constructor and Description |
---|
SupervisingRouteController() |
Modifier and Type | Method and Description |
---|---|
void |
addFilter(SupervisingRouteController.Filter filter)
Add a filter used to determine the routes to supervise.
|
protected void |
doShutdown()
Implementations override this method to perform customized shutdown.
|
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
BackOff |
getBackOff(String id) |
Map<String,BackOff> |
getBackOffConfigurations() |
Optional<BackOffTimer.Task> |
getBackOffContext(String id) |
Collection<Route> |
getControlledRoutes()
Return the list of routes controlled by this controller.
|
BackOff |
getDefaultBackOff() |
Collection<SupervisingRouteController.Filter> |
getFilters() |
Duration |
getInitialDelay() |
void |
resumeRoute(String routeId) |
void |
setBackOff(String id,
BackOff backOff)
Sets the back-off to be applied to the given
id . |
void |
setBackOffConfigurations(Map<String,BackOff> backOffConfigurations)
Set the back-off for the given IDs.
|
void |
setDefaultBackOff(BackOff defaultBackOff)
Sets the default back-off.
|
void |
setFilters(Collection<SupervisingRouteController.Filter> filters)
Sets the filters user to determine the routes to supervise.
|
void |
setInitialDelay(Duration initialDelay)
Set the amount of time the route controller should wait before to start
the routes after the camel context is started or after the route is
initialized if the route is created after the camel context is started.
|
void |
setInitialDelay(long initialDelay)
#see
this#setInitialDelay(Duration) |
void |
setInitialDelay(long initialDelay,
TimeUnit initialDelayUnit)
#see
this#setInitialDelay(Duration) |
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) |
getCamelContext, setCamelContext
doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
unwrap
public SupervisingRouteController()
public BackOff getDefaultBackOff()
public void setDefaultBackOff(BackOff defaultBackOff)
public Map<String,BackOff> getBackOffConfigurations()
public void setBackOffConfigurations(Map<String,BackOff> backOffConfigurations)
public BackOff getBackOff(String id)
public void setBackOff(String id, BackOff backOff)
id
.public Duration getInitialDelay()
public void setInitialDelay(Duration initialDelay)
initialDelay
- the initial delay.public void setInitialDelay(long initialDelay, TimeUnit initialDelayUnit)
this#setInitialDelay(Duration)
initialDelay
- the initial delay amount.public void setInitialDelay(long initialDelay)
this#setInitialDelay(Duration)
initialDelay
- the initial delay in milliseconds.public void addFilter(SupervisingRouteController.Filter filter)
public void setFilters(Collection<SupervisingRouteController.Filter> filters)
public Collection<SupervisingRouteController.Filter> getFilters()
public Optional<BackOffTimer.Task> getBackOffContext(String id)
protected void doStart() throws Exception
ServiceSupport
ServiceSupport.doStop()
for more details.doStart
in class DefaultRouteController
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.doStop()
method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext
is shutting down.doStop
in class DefaultRouteController
Exception
ServiceSupport.doStart()
protected void doShutdown() throws Exception
ServiceSupport
doShutdown
in class ServiceSupport
Exception
public void startRoute(String routeId) throws Exception
startRoute
in interface RouteController
startRoute
in class DefaultRouteController
Exception
public void stopRoute(String routeId) throws Exception
stopRoute
in interface RouteController
stopRoute
in class DefaultRouteController
Exception
public void stopRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception
stopRoute
in interface RouteController
stopRoute
in class DefaultRouteController
Exception
public boolean stopRoute(String routeId, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout) throws Exception
stopRoute
in interface RouteController
stopRoute
in class DefaultRouteController
Exception
public void suspendRoute(String routeId) throws Exception
suspendRoute
in interface RouteController
suspendRoute
in class DefaultRouteController
Exception
public void suspendRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception
suspendRoute
in interface RouteController
suspendRoute
in class DefaultRouteController
Exception
public void resumeRoute(String routeId) throws Exception
resumeRoute
in interface RouteController
resumeRoute
in class DefaultRouteController
Exception
public Collection<Route> getControlledRoutes()
RouteController
getControlledRoutes
in interface RouteController
getControlledRoutes
in class DefaultRouteController
Apache Camel