Interface RoutePolicy
public interface RoutePolicy
Per-route lifecycle hook that receives callbacks at each state change and at the beginning and end of every
does), enforce time-window scheduling, or perform custom instrumentation. Policies are attached to a route via the
DSL
Exchange, enabling dynamic control of route behaviour at runtime.
A RoutePolicy can suspend or resume a route's consumer in response to external conditions, implement
throttling by counting inflight exchanges (as
invalid reference
org.apache.camel.throttling.ThrottlingInflightRoutePolicy
.routePolicy() call or globally via a RoutePolicyFactory registered on the context.
See the Route Policy documentation for usage patterns
and built-in implementations.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidonExchangeBegin(Route route, Exchange exchange) voidonExchangeDone(Route route, Exchange exchange) voidCallback invoked when theRouteis being initializedvoidCallback invoked when theRouteis being removed fromCamelContextvoidCallback invoked when theRouteis being resumedvoidCallback invoked when theRouteis being startedvoidCallback invoked when theRouteis being stoppedvoidCallback invoked when theRouteis being suspended
-
Method Details
-
onInit
-
onRemove
Callback invoked when theRouteis being removed fromCamelContext- Parameters:
route- the route being removed
-
onStart
-
onStop
-
onSuspend
-
onResume
-
onExchangeBegin
-
onExchangeDone
Callback invoked when anExchangeis done being routed, where it started from the givenRouteNotice this callback is invoked when the Exchange is done and theRouteis the route where theExchangewas started. Most often its also the route where the exchange is done. However, it's possible to route anExchangeto other routes using endpoints such as direct or seda. Bottom line is that theRouteparameter may not be the endpoint route and thus why we state it's the starting route.- Parameters:
route- the route where the exchange started fromexchange- the created exchange
-