org.apache.camel.spi
Interface RoutePolicy

All Known Implementing Classes:
RoutePolicySupport, ThrottlingInflightRoutePolicy

public interface RoutePolicy

Policy for a Route which allows controlling the route at runtime.

For example using the ThrottlingInflightRoutePolicy to throttle the Route at runtime where it suspends and resume the Route.getConsumer().

Version:
$Revision: 16694 $

Method Summary
 void onExchangeBegin(Route route, Exchange exchange)
          Callback invokes when an Exchange is started being routed on the given Route
 void onExchangeDone(Route route, Exchange exchange)
          Callback invokes when an Exchange is done being routed, where it started from the given Route

Notice this callback is invoked when the Exchange is done and the Route is the route where the Exchange was started.

 

Method Detail

onExchangeBegin

void onExchangeBegin(Route route,
                     Exchange exchange)
Callback invokes when an Exchange is started being routed on the given Route

Parameters:
route - the route where the exchange started from
exchange - the created exchange

onExchangeDone

void onExchangeDone(Route route,
                    Exchange exchange)
Callback invokes when an Exchange is done being routed, where it started from the given Route

Notice this callback is invoked when the Exchange is done and the Route is the route where the Exchange was started. Most often its also the route where the exchange is done. However its possible to route an Exchange to other routes using endpoints such as direct or seda. Bottom line is that the Route parameter may not be the endpoint route and thus why we state its the starting route.

Parameters:
route - the route where the exchange started from
exchange - the created exchange


Copyright © 2007-2010 IONA Open Source Community. All Rights Reserved.