|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.unitofwork.UnitOfWorkListenerAdapter org.axonframework.auditing.AuditingUnitOfWorkListener
public class AuditingUnitOfWorkListener
Listener implementation that adds auditing information to events being tracked by the unit of work this listener is registered to.
Constructor Summary | |
---|---|
AuditingUnitOfWorkListener(CommandMessage<?> command,
AuditDataProvider auditDataProvider,
AuditLogger auditLogger)
Initialize a listener for the given command . |
Method Summary | ||
---|---|---|
void |
afterCommit(UnitOfWork unitOfWork)
Invoked when the UnitOfWork is committed. |
|
|
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. |
Methods inherited from class org.axonframework.unitofwork.UnitOfWorkListenerAdapter |
---|
onCleanup, onPrepareCommit, onPrepareTransactionCommit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public 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 auditMethod Detail |
---|
public void afterCommit(UnitOfWork unitOfWork)
UnitOfWorkListenerAdapter
UnitOfWorkListener.onRollback(UnitOfWork, Throwable)
consecutively.
afterCommit
in interface UnitOfWorkListener
afterCommit
in class UnitOfWorkListenerAdapter
unitOfWork
- The Unit of Work being committedUnitOfWork.commit()
public void onRollback(UnitOfWork unitOfWork, Throwable failureCause)
UnitOfWorkListenerAdapter
onRollback
in interface UnitOfWorkListener
onRollback
in class UnitOfWorkListenerAdapter
unitOfWork
- 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)
UnitOfWorkListenerAdapter
event
.
onEventRegistered
in interface UnitOfWorkListener
onEventRegistered
in class UnitOfWorkListenerAdapter
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |