public class AuditingUnitOfWorkListener extends UnitOfWorkListenerAdapter
| Constructor and Description |
|---|
AuditingUnitOfWorkListener(CommandMessage<?> command,
AuditDataProvider auditDataProvider,
AuditLogger auditLogger)
Initialize a listener for the given
command. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterCommit(UnitOfWork unitOfWork)
Invoked when the UnitOfWork is committed.
|
<T> EventMessage<T> |
onEventRegistered(UnitOfWork unitOfWork,
EventMessage<T> event)
Invoked when an Event is registered for publication when the UnitOfWork is committed.
|
void |
onRollback(UnitOfWork unitOfWork,
Throwable failureCause)
Invoked when the UnitOfWork is rolled back.
|
onCleanup, onPrepareCommit, onPrepareTransactionCommitpublic AuditingUnitOfWorkListener(CommandMessage<?> command, AuditDataProvider auditDataProvider, AuditLogger auditLogger)
command. The auditDataProvider is called before
the Unit Of Work is committed to provide the auditing information. The auditLogger is invoked after
the Unit Of Work is successfully committed.command - The command being auditedauditDataProvider - The instance providing the information to attach to the eventsauditLogger - The logger writing the auditpublic void afterCommit(UnitOfWork unitOfWork)
UnitOfWorkListenerAdapterUnitOfWorkListener.onRollback(UnitOfWork, Throwable) consecutively.afterCommit in interface UnitOfWorkListenerafterCommit in class UnitOfWorkListenerAdapterunitOfWork - The Unit of Work being committedUnitOfWork.commit()public void onRollback(UnitOfWork unitOfWork, Throwable failureCause)
UnitOfWorkListenerAdapteronRollback in interface UnitOfWorkListeneronRollback in class UnitOfWorkListenerAdapterunitOfWork - The Unit of Work being rolled backfailureCause - The exception (or error) causing the roll backUnitOfWork.rollback(Throwable)public <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 publicationCopyright © 2010-2014. All Rights Reserved.