|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface UnitOfWorkListener
Interface describing a listener that is notified of state changes in the UnitOfWork it has been registered with.
Method Summary | ||
---|---|---|
void |
afterCommit(UnitOfWork unitOfWork)
Invoked when the UnitOfWork is committed. |
|
void |
onCleanup(UnitOfWork unitOfWork)
Notifies listeners that the UnitOfWork is being cleaned up. |
|
|
onEventRegistered(UnitOfWork unitOfWork,
EventMessage<T> event)
Invoked when an Event is registered for publication when the UnitOfWork is committed. |
|
void |
onPrepareCommit(UnitOfWork unitOfWork,
Set<AggregateRoot> aggregateRoots,
List<EventMessage> events)
Invoked before aggregates are committed, and before any events are published. |
|
void |
onPrepareTransactionCommit(UnitOfWork unitOfWork,
Object transaction)
Invoked before the transaction bound to this Unit of Work is committed, but after all other commit activities (publication of events and saving of aggregates) are performed. |
|
void |
onRollback(UnitOfWork unitOfWork,
Throwable failureCause)
Invoked when the UnitOfWork is rolled back. |
Method Detail |
---|
void afterCommit(UnitOfWork unitOfWork)
onRollback(UnitOfWork, Throwable)
consecutively.
unitOfWork
- The Unit of Work being committedUnitOfWork.commit()
void onRollback(UnitOfWork unitOfWork, Throwable failureCause)
unitOfWork
- The Unit of Work being rolled backfailureCause
- The exception (or error) causing the roll backUnitOfWork.rollback(Throwable)
<T> EventMessage<T> onEventRegistered(UnitOfWork unitOfWork, EventMessage<T> event)
event
.
T
- The type of payload of the EventMessageunitOfWork
- The Unit of Work on which an event is registeredevent
- The event about to be registered for publication
void onPrepareCommit(UnitOfWork unitOfWork, Set<AggregateRoot> aggregateRoots, List<EventMessage> events)
events
may not contain the uncommitted domain events of each of the
aggregateRoots
. To retrieve all events, collect all uncommitted events from the aggregate roots and
combine them with the list of events.
unitOfWork
- The Unit of Work being committedaggregateRoots
- the aggregate roots being committedevents
- Events that have been registered for dispatching with the UnitOfWorkvoid onPrepareTransactionCommit(UnitOfWork unitOfWork, Object transaction)
unitOfWork
- The Unit of Work of which the underlying transaction is being committed.transaction
- The object representing the (status of) the transaction, as returned by TransactionManager.startTransaction()
.TransactionManager
void onCleanup(UnitOfWork unitOfWork)
unitOfWork
- The Unit of Work being cleaned up
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |