Class RouteDefinitionHelper

    • Method Detail

      • gatherAllStaticEndpointUris

        public static Set<String> gatherAllStaticEndpointUris​(org.apache.camel.CamelContext camelContext,
                                                              RouteDefinition route,
                                                              boolean includeInputs,
                                                              boolean includeOutputs)
        Gather all the endpoint uri's the route is using from the EIPs that has a static endpoint defined.
        Parameters:
        route - the route
        includeInputs - whether to include inputs
        includeOutputs - whether to include outputs
        Returns:
        the endpoints uris
      • gatherAllEndpointUris

        public static Set<String> gatherAllEndpointUris​(org.apache.camel.CamelContext camelContext,
                                                        RouteDefinition route,
                                                        boolean includeInput,
                                                        boolean includeOutputs,
                                                        boolean includeDynamic)
        Gather all the endpoint uri's the route is using from the EIPs that has a static or dynamic endpoint defined.
        Parameters:
        route - the route
        includeInput - whether to include inputs
        includeOutputs - whether to include outputs
        includeDynamic - whether to include dynamic outputs which has been in use during routing at runtime, gathered from the RuntimeEndpointRegistry.
        Returns:
        the endpoints uris
      • forceAssignIds

        public static void forceAssignIds​(org.apache.camel.CamelContext context,
                                          List<RouteDefinition> routes)
                                   throws Exception
        Force assigning ids to the routes
        Parameters:
        context - the camel context
        routes - the routes
        Throws:
        Exception - is thrown if error force assign ids to the routes
      • validateUniqueIds

        public static String validateUniqueIds​(RouteDefinition target,
                                               List<RouteDefinition> routes)
        Validates that the target route has no duplicate id's from any of the existing routes.
        Parameters:
        target - the target route
        routes - the existing routes
        Returns:
        null if no duplicate id's detected, otherwise the first found duplicate id is returned.
      • prepareRoute

        public static void prepareRoute​(org.apache.camel.CamelContext context,
                                        RouteDefinition route)
        Prepares the route.

        This method does not mark the route as prepared afterwards.

        Parameters:
        context - the camel context
        route - the route
      • prepareRoute

        public static void prepareRoute​(org.apache.camel.CamelContext context,
                                        RouteDefinition route,
                                        ErrorHandlerDefinition errorHandler,
                                        List<OnExceptionDefinition> onExceptions,
                                        List<InterceptDefinition> intercepts,
                                        List<InterceptFromDefinition> interceptFromDefinitions,
                                        List<InterceptSendToEndpointDefinition> interceptSendToEndpointDefinitions,
                                        List<OnCompletionDefinition> onCompletions)
        Prepares the route which supports context scoped features such as onException, interceptors and onCompletions

        This method does not mark the route as prepared afterwards.

        Parameters:
        context - the camel context
        route - the route
        errorHandler - optional error handler
        onExceptions - optional list of onExceptions
        intercepts - optional list of interceptors
        interceptFromDefinitions - optional list of interceptFroms
        interceptSendToEndpointDefinitions - optional list of interceptSendToEndpoints
        onCompletions - optional list onCompletions
      • sanityCheckRoute

        public static void sanityCheckRoute​(RouteDefinition route)
        Sanity check the route, that it has input(s) and outputs.
        Parameters:
        route - the route
        Throws:
        IllegalArgumentException - is thrown if the route is invalid
      • forceAssignIds

        public static void forceAssignIds​(org.apache.camel.CamelContext context,
                                          ProcessorDefinition processor)
        Force assigning ids to the give node and all its children (recursively).

        This is needed when doing tracing or the likes, where each node should have its id assigned so the tracing can pin point exactly.

        Parameters:
        context - the camel context
        processor - the node
      • getRouteMessage

        public static String getRouteMessage​(String route)