org.apache.camel.impl
Class RoutePolicySupport

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.impl.RoutePolicySupport
All Implemented Interfaces:
Service, RoutePolicy
Direct Known Subclasses:
ThrottlingInflightRoutePolicy

public abstract class RoutePolicySupport
extends ServiceSupport
implements RoutePolicy

A base class for developing custom RoutePolicy implementations.

Version:
$Revision: 16089 $

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
RoutePolicySupport()
           
 
Method Summary
protected  void doStart()
           
protected  void doStop()
           
 ExceptionHandler getExceptionHandler()
           
protected  void handleException(Throwable t)
          Handles the given exception using the getExceptionHandler()
 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.

 void setExceptionHandler(ExceptionHandler exceptionHandler)
           
protected  boolean startConsumer(Consumer consumer)
           
protected  boolean stopConsumer(Consumer consumer)
           
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, removeChildService, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final transient org.apache.commons.logging.Log log
Constructor Detail

RoutePolicySupport

public RoutePolicySupport()
Method Detail

onExchangeBegin

public void onExchangeBegin(Route route,
                            Exchange exchange)
Description copied from interface: RoutePolicy
Callback invokes when an Exchange is started being routed on the given Route

Specified by:
onExchangeBegin in interface RoutePolicy
Parameters:
route - the route where the exchange started from
exchange - the created exchange

onExchangeDone

public void onExchangeDone(Route route,
                           Exchange exchange)
Description copied from interface: RoutePolicy
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.

Specified by:
onExchangeDone in interface RoutePolicy
Parameters:
route - the route where the exchange started from
exchange - the created exchange

startConsumer

protected boolean startConsumer(Consumer consumer)
                         throws Exception
Throws:
Exception

stopConsumer

protected boolean stopConsumer(Consumer consumer)
                        throws Exception
Throws:
Exception

handleException

protected void handleException(Throwable t)
Handles the given exception using the getExceptionHandler()

Parameters:
t - the exception to handle

doStart

protected void doStart()
                throws Exception
Specified by:
doStart in class ServiceSupport
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Specified by:
doStop in class ServiceSupport
Throws:
Exception

getExceptionHandler

public ExceptionHandler getExceptionHandler()

setExceptionHandler

public void setExceptionHandler(ExceptionHandler exceptionHandler)


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