|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.auditing.AuditingInterceptor
public class AuditingInterceptor
Interceptor that keeps track of commands and the events that were dispatched as a result of handling that command.
The AuditingInterceptor uses the current Unit Of Work to track all events being stored and published. The auditing
information provided by the AuditDataProvider
is attached to each of these events
just before the Unit Of Work is committed. After the Unit Of Work has been committed, an optional AuditLogger
may write an entry to the audit logs.
AxonConfigurationException
.
The auditing interceptor can only attach meta data to event whose Message.getMetaData()
methods returns an instance of MetaData
, which is the default behavior
for any event implementation provided by Axon.
Constructor Summary | |
---|---|
AuditingInterceptor()
|
Method Summary | |
---|---|
Object |
handle(CommandMessage<?> command,
UnitOfWork unitOfWork,
InterceptorChain chain)
The handle method is invoked each time a command is dispatched through the command bus that the CommandHandlerInterceptor is declared on. |
void |
setAuditDataProvider(AuditDataProvider auditDataProvider)
Sets the AuditingDataProvider for this interceptor. |
void |
setAuditLogger(AuditLogger auditLogger)
Sets the logger that writes events to the audit logs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AuditingInterceptor()
Method Detail |
---|
public Object handle(CommandMessage<?> command, UnitOfWork unitOfWork, InterceptorChain chain) throws Throwable
CommandHandlerInterceptor
unitOfWork
.
The interceptor is responsible for the continuation of the dispatch process by invoking the InterceptorChain.proceed(CommandMessage)
method on the given
interceptorChain
.
Any information gathered by interceptors may be attached to the unitOfWork. This information is made
available to the CommandCallback provided by the dispatching component.
Interceptors are highly recommended not to change the type of the command handling result, as the dispatching
component might expect a result of a specific type.
handle
in interface CommandHandlerInterceptor
command
- The command being dispatchedunitOfWork
- The UnitOfWork in whichchain
- The interceptor chain that allows this interceptor to proceed the dispatch process
Throwable
- any exception that occurs while handling the commandpublic void setAuditDataProvider(AuditDataProvider auditDataProvider)
EmptyDataProvider
, which provides no
correlation information.
auditDataProvider
- the instance providing the auditing information to attach to the events.public void setAuditLogger(AuditLogger auditLogger)
NullAuditLogger
, which does nothing.
auditLogger
- the logger that writes events to the audit logs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |