Interface RoutePolicyFactory


public interface RoutePolicyFactory
Factory that creates a RoutePolicy instance for each route automatically at startup, without requiring the policy to be declared per-route in the DSL.

Factories are registered globally via CamelContext.addRoutePolicyFactory(RoutePolicyFactory) and are called once per route during CamelContext startup. Returning null from createRoutePolicy(org.apache.camel.CamelContext, String, org.apache.camel.NamedNode) opts that specific route out of the policy. This is useful for cross-cutting concerns such as universal throttling, auditing, or metrics collection that should apply to all routes.

See the Route Policy documentation for examples.

See Also:
  • Method Details

    • createRoutePolicy

      @Nullable RoutePolicy createRoutePolicy(CamelContext camelContext, String routeId, NamedNode route)
      Creates a new RoutePolicy which will be assigned to the given route.
      Parameters:
      camelContext - the camel context
      routeId - the route id
      route - the route definition
      Returns:
      the created RoutePolicy, or null to not use a policy for this route