Package org.apache.camel.spi
Interface RoutePolicy
public interface RoutePolicy
Policy for a
Route
which allows controlling the route at runtime.
For example using the org.apache.camel.throttling.ThrottlingInflightRoutePolicy
to throttle the Route
at runtime where it suspends and resume the Route.getConsumer()
.
See also Route
class javadoc about controlling the lifecycle of a Route
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onExchangeBegin
(Route route, Exchange exchange) void
onExchangeDone
(Route route, Exchange exchange) void
Callback invoked when theRoute
is being initializedvoid
Callback invoked when theRoute
is being removed fromCamelContext
void
Callback invoked when theRoute
is being resumedvoid
Callback invoked when theRoute
is being startedvoid
Callback invoked when theRoute
is being stoppedvoid
Callback invoked when theRoute
is being suspended
-
Method Details
-
onInit
Callback invoked when theRoute
is being initialized- Parameters:
route
- the route being initialized
-
onRemove
Callback invoked when theRoute
is being removed fromCamelContext
- Parameters:
route
- the route being removed
-
onStart
Callback invoked when theRoute
is being started- Parameters:
route
- the route being started
-
onStop
Callback invoked when theRoute
is being stopped- Parameters:
route
- the route being stopped
-
onSuspend
Callback invoked when theRoute
is being suspended- Parameters:
route
- the route being suspended
-
onResume
Callback invoked when theRoute
is being resumed- Parameters:
route
- the route being resumed
-
onExchangeBegin
- Parameters:
route
- the route where the exchange started fromexchange
- the created exchange
-
onExchangeDone
Callback invoked when anExchange
is done being routed, where it started from the givenRoute
Notice this callback is invoked when the Exchange is done and theRoute
is the route where theExchange
was started. Most often its also the route where the exchange is done. However its possible to route anExchange
to other routes using endpoints such as direct or seda. Bottom line is that theRoute
parameter may not be the endpoint route and thus why we state its the starting route.- Parameters:
route
- the route where the exchange started fromexchange
- the created exchange
-