Interface RouteController

    • Method Detail

      • getLoggingLevel

        LoggingLevel getLoggingLevel()
        Gets the logging level used for logging route activity (such as starting and stopping routes). The default logging level is DEBUG.
      • setLoggingLevel

        void setLoggingLevel​(LoggingLevel loggingLevel)
        Sets the logging level used for logging route activity (such as starting and stopping routes). The default logging level is DEBUG.
      • isSupervising

        boolean isSupervising()
        Whether this route controller is a regular or supervising controller.
      • adapt

        <T extends RouteController> T adapt​(Class<T> type)
        Adapts this RouteController 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
      • stopAllRoutes

        void stopAllRoutes()
                    throws Exception
        Stops all the routes
        Throws:
        Exception - is thrown if a route could not be stopped for whatever reason
      • removeAllRoutes

        void removeAllRoutes()
                      throws Exception
        Stops and removes all the routes
        Throws:
        Exception - is thrown if a route could not be stopped or removed for whatever reason
      • isStartingRoutes

        boolean isStartingRoutes()
        Indicates whether current thread is starting route(s).

        This can be useful to know by LifecycleStrategy 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

        boolean stopRoute​(String routeId,
                          long timeout,
                          TimeUnit timeUnit,
                          boolean abortAfterTimeout)
                   throws Exception
        Stops the given route using ShutdownStrategy with a specified timeout and optional abortAfterTimeout mode.
        Parameters:
        routeId - the route id
        timeout - timeout
        timeUnit - the unit to use
        abortAfterTimeout - 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 using ShutdownStrategy.

        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 using ShutdownStrategy 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 id
        timeout - timeout
        timeUnit - 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