org.apache.camel.support
Class SynchronizationAdapter

java.lang.Object
  extended by org.apache.camel.support.SynchronizationAdapter
All Implemented Interfaces:
Ordered, Synchronization, SynchronizationRouteAware, SynchronizationVetoable
Direct Known Subclasses:
SynchronizationAdapter

public class SynchronizationAdapter
extends Object
implements SynchronizationVetoable, Ordered, SynchronizationRouteAware

Simple Synchronization adapter with empty methods for easier overriding of single methods.

Version:

Field Summary
 
Fields inherited from interface org.apache.camel.Ordered
HIGHEST, LOWEST
 
Constructor Summary
SynchronizationAdapter()
           
 
Method Summary
 boolean allowHandover()
          Whether or not handover this synchronization is allowed.
 int getOrder()
          Gets the order.
 void onAfterRoute(Route route, Exchange exchange)
          Invoked after the Exchange has been routed by the given route.
 void onBeforeRoute(Route route, Exchange exchange)
          Invoked before the Exchange is being routed by the given route.
 void onComplete(Exchange exchange)
          Called when the processing of the message exchange is complete
 void onDone(Exchange exchange)
           
 void onFailure(Exchange exchange)
          Called when the processing of the message exchange has failed for some reason.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizationAdapter

public SynchronizationAdapter()
Method Detail

onComplete

public void onComplete(Exchange exchange)
Description copied from interface: Synchronization
Called when the processing of the message exchange is complete

Specified by:
onComplete in interface Synchronization
Parameters:
exchange - the exchange being processed

onFailure

public void onFailure(Exchange exchange)
Description copied from interface: Synchronization
Called when the processing of the message exchange has failed for some reason. The exception which caused the problem is in Exchange.getException() and there could be a fault message via Message.isFault()

Specified by:
onFailure in interface Synchronization
Parameters:
exchange - the exchange being processed

onDone

public void onDone(Exchange exchange)

allowHandover

public boolean allowHandover()
Description copied from interface: SynchronizationVetoable
Whether or not handover this synchronization is allowed.

For example when an Exchange is being routed from one thread to another thread, such as using request/reply over SEDA

Specified by:
allowHandover in interface SynchronizationVetoable
Returns:
true to allow handover, false to deny.

getOrder

public int getOrder()
Description copied from interface: Ordered
Gets the order.

Use low numbers for higher priority. Normally the sorting will start from 0 and move upwards. So if you want to be last then use Integer.MAX_VALUE or eg Ordered.LOWEST.

Specified by:
getOrder in interface Ordered
Returns:
the order

onBeforeRoute

public void onBeforeRoute(Route route,
                          Exchange exchange)
Description copied from interface: SynchronizationRouteAware
Invoked before the Exchange is being routed by the given route.

Notice if the exchange is being routed through multiple routes, there will be callbacks for each route.

Important: this callback may not invoked if the SynchronizationRouteAware implementation is being added to the UnitOfWork after the routing has started.

Specified by:
onBeforeRoute in interface SynchronizationRouteAware
Parameters:
route - the route
exchange - the exchange

onAfterRoute

public void onAfterRoute(Route route,
                         Exchange exchange)
Description copied from interface: SynchronizationRouteAware
Invoked after the Exchange has been routed by the given route.

Notice if the exchange is being routed through multiple routes, there will be callbacks for each route.

This invocation happens before these callbacks:

This allows custom logic to be executed after all routing is done, but before the Consumer prepares and writes any data back to the caller (if in InOut mode).

Specified by:
onAfterRoute in interface SynchronizationRouteAware
Parameters:
route - the route
exchange - the exchange


Apache Camel