Package org.apache.camel.spi
Interface RouteController
-
- All Superinterfaces:
AutoCloseable
,CamelContextAware
,Service
,StaticService
- All Known Subinterfaces:
SupervisingRouteController
public interface RouteController extends CamelContextAware, StaticService
Controller for managing the lifecycle of all theRoute
's.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends RouteController>
Tadapt(Class<T> type)
Adapts thisRouteController
to the specialized type.Collection<Route>
getControlledRoutes()
Return the list of routes controlled by this controller.LoggingLevel
getRouteStartupLoggingLevel()
Gets the logging level used for logging route startup activity.ServiceStatus
getRouteStatus(String routeId)
Returns the current status of the given routeboolean
isStartingRoutes()
Indicates whether current thread is starting route(s).void
resumeRoute(String routeId)
Resumes the given route if it has been previously suspendedvoid
setRouteStartupLoggingLevel(LoggingLevel loggingLevel)
Sets the logging level used for logging route startup activity.void
startAllRoutes()
Starts all the routes which currently is not started.void
startRoute(String routeId)
Starts the given route if it has been previously stoppedvoid
stopRoute(String routeId)
Stops the given route usingShutdownStrategy
.void
stopRoute(String routeId, long timeout, TimeUnit timeUnit)
Stops the given route usingShutdownStrategy
with a specified timeout.boolean
stopRoute(String routeId, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout)
Stops the given route usingShutdownStrategy
with a specified timeout and optional abortAfterTimeout mode.SupervisingRouteController
supervising()
Enables supervisingRouteController
.void
suspendRoute(String routeId)
Suspends the given route usingShutdownStrategy
.void
suspendRoute(String routeId, long timeout, TimeUnit timeUnit)
Suspends the given route usingShutdownStrategy
with a specified timeout.-
Methods inherited from interface org.apache.camel.CamelContextAware
getCamelContext, setCamelContext
-
-
-
-
Method Detail
-
getRouteStartupLoggingLevel
LoggingLevel getRouteStartupLoggingLevel()
Gets the logging level used for logging route startup activity.
-
setRouteStartupLoggingLevel
void setRouteStartupLoggingLevel(LoggingLevel loggingLevel)
Sets the logging level used for logging route startup activity. By default INFO level is used. You can use this to change the level for example to OFF if this kind of logging is not wanted.
-
supervising
SupervisingRouteController supervising()
Enables supervisingRouteController
.
-
adapt
<T extends RouteController> T adapt(Class<T> type)
Adapts thisRouteController
to the specialized type. For example to adapt to SupervisingRouteController.- Parameters:
type
- the type to adapt to- Returns:
- this
CamelContext
adapted to the given type
-
getControlledRoutes
Collection<Route> getControlledRoutes()
Return the list of routes controlled by this controller.- Returns:
- the list of controlled routes
-
startAllRoutes
void startAllRoutes() throws Exception
Starts all the routes which currently is not started.- Throws:
Exception
- is thrown if a route could not be started for whatever reason
-
isStartingRoutes
boolean isStartingRoutes()
Indicates whether current thread is starting route(s). This can be useful to know byLifecycleStrategy
or the likes, in case they need to react differently.- Returns:
- true if current thread is starting route(s), or false if not.
-
getRouteStatus
ServiceStatus getRouteStatus(String routeId)
Returns the current status of the given route- Parameters:
routeId
- the route id- Returns:
- the status for the route
-
startRoute
void startRoute(String routeId) throws Exception
Starts the given route if it has been previously stopped- Parameters:
routeId
- the route id- Throws:
Exception
- is thrown if the route could not be started for whatever reason
-
stopRoute
void stopRoute(String routeId) throws Exception
Stops the given route usingShutdownStrategy
.- Parameters:
routeId
- the route id- Throws:
Exception
- is thrown if the route could not be stopped for whatever reason- See Also:
suspendRoute(String)
-
stopRoute
void stopRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception
Stops the given route usingShutdownStrategy
with a specified timeout.- Parameters:
routeId
- the route idtimeout
- timeouttimeUnit
- the unit to use- Throws:
Exception
- is thrown if the route could not be stopped for whatever reason- See Also:
suspendRoute(String, long, java.util.concurrent.TimeUnit)
-
stopRoute
boolean stopRoute(String routeId, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout) throws Exception
Stops the given route usingShutdownStrategy
with a specified timeout and optional abortAfterTimeout mode.- Parameters:
routeId
- the route idtimeout
- timeouttimeUnit
- the unit to useabortAfterTimeout
- should abort shutdown after timeout- Returns:
- true if the route is stopped before the timeout
- Throws:
Exception
- is thrown if the route could not be stopped for whatever reason- See Also:
suspendRoute(String, long, java.util.concurrent.TimeUnit)
-
suspendRoute
void suspendRoute(String routeId) throws Exception
Suspends the given route usingShutdownStrategy
. Suspending a route is more gently than stopping, as the route consumers will be suspended (if they support) otherwise the consumers will be stopped. By suspending the route services will be kept running (if possible) and therefore its faster to resume the route. If the route does not support suspension the route will be stopped instead- Parameters:
routeId
- the route id- Throws:
Exception
- is thrown if the route could not be suspended for whatever reason
-
suspendRoute
void suspendRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception
Suspends the given route usingShutdownStrategy
with a specified timeout. Suspending a route is more gently than stopping, as the route consumers will be suspended (if they support) otherwise the consumers will be stopped. By suspending the route services will be kept running (if possible) and therefore its faster to resume the route. If the route does not support suspension the route will be stopped instead- Parameters:
routeId
- the route idtimeout
- timeouttimeUnit
- the unit to use- Throws:
Exception
- is thrown if the route could not be suspended for whatever reason
-
resumeRoute
void resumeRoute(String routeId) throws Exception
Resumes the given route if it has been previously suspended If the route does not support suspension the route will be started instead- Parameters:
routeId
- the route id- Throws:
Exception
- is thrown if the route could not be resumed for whatever reason
-
-