org.apache.camel.spi
Interface UnitOfWork

All Known Subinterfaces:
TraceableUnitOfWork
All Known Implementing Classes:
DefaultUnitOfWork

public interface UnitOfWork

An object representing the unit of work processing an Exchange which allows the use of Synchronization hooks. This object might map one-to-one with a transaction in JPA or Spring; or might not.

Version:
$Revision: 777808 $

Method Summary
 void addSynchronization(Synchronization synchronization)
          Adds a synchronization hook
 void done(Exchange exchange)
          Invoked when this unit of work has been completed, whether it has failed or completed
 String getId()
          Returns the unique ID of this unit of work, lazily creating one if it does not yet have one
 Object getOriginalInBody()
          Gets the original IN body this Unit of Work was started with.
 void handoverSynchronization(Exchange target)
          Handover all the registered synchronizations to the target Exchange.
 void removeSynchronization(Synchronization synchronization)
          Removes a synchronization hook
 

Method Detail

addSynchronization

void addSynchronization(Synchronization synchronization)
Adds a synchronization hook

Parameters:
synchronization - the hook

removeSynchronization

void removeSynchronization(Synchronization synchronization)
Removes a synchronization hook

Parameters:
synchronization - the hook

handoverSynchronization

void handoverSynchronization(Exchange target)
Handover all the registered synchronizations to the target Exchange.

This is used when a route turns into asynchronous and the Exchange that is continued and routed in the async thread should do the on completion callbacks instead of the original synchronous thread.

Parameters:
target - the target exchange

done

void done(Exchange exchange)
Invoked when this unit of work has been completed, whether it has failed or completed

Parameters:
exchange - the current exchange

getId

String getId()
Returns the unique ID of this unit of work, lazily creating one if it does not yet have one

Returns:
the unique ID

getOriginalInBody

Object getOriginalInBody()
Gets the original IN body this Unit of Work was started with.

Returns:
the original IN body


Copyright © 2009 Apache Software Foundation. All Rights Reserved.