public abstract class MetaDataMutatingUnitOfWorkListenerAdapter extends UnitOfWorkListenerAdapter
| Constructor and Description |
|---|
MetaDataMutatingUnitOfWorkListenerAdapter() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Map<String,?> |
assignMetaData(EventMessage event,
List<EventMessage> events,
int index)
Defines the additional meta data to assign to the given
event. |
<T> EventMessage<T> |
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.
|
afterCommit, onCleanup, onPrepareTransactionCommit, onRollbackpublic MetaDataMutatingUnitOfWorkListenerAdapter()
public final <T> EventMessage<T> onEventRegistered(UnitOfWork unitOfWork, EventMessage<T> event)
UnitOfWorkListenerAdapterevent.onEventRegistered in interface UnitOfWorkListeneronEventRegistered in class UnitOfWorkListenerAdapterT - The type of payload of the EventMessageunitOfWork - The Unit of Work on which an event is registeredevent - The event about to be registered for publicationpublic void onPrepareCommit(UnitOfWork unitOfWork, Set<AggregateRoot> aggregateRoots, List<EventMessage> events)
UnitOfWorkListenerAdapterevents 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.onPrepareCommit in interface UnitOfWorkListeneronPrepareCommit in class UnitOfWorkListenerAdapterunitOfWork - The Unit of Work being committedaggregateRoots - the aggregate roots being committedevents - Events that have been registered for dispatching with the UnitOfWorkprotected abstract Map<String,?> assignMetaData(EventMessage event, List<EventMessage> events, int index)
event. For reference, the entire list of
events is provided, where the given event can be found at given index.
Any entries returned that already exist are overwritten by the entry in the Map returned. Other entries are
added.
This method is invoked for each of the events.event - The event for which to assign additional meta dataevents - The entire list of events part of this unit of workindex - The index at which the event can be found in the list of eventsCopyright © 2010-2015. All Rights Reserved.