org.axonframework.commandhandling
Interface CommandHandlerInterceptor

All Known Implementing Classes:
AuditingInterceptor, LoggingInterceptor, SpringTransactionalInterceptor, TransactionInterceptor

public interface CommandHandlerInterceptor

Workflow interface that allows for customized command handler invocation chains. A CommandHandlerInterceptor can add customized behavior to command handler invocations, both before and after the invocation.

Since:
0.5
Author:
Allard Buijze

Method Summary
 Object handle(Object command, UnitOfWork unitOfWork, InterceptorChain interceptorChain)
          The handle method is invoked each time a command is dispatched through the event bus that the CommandHandlerInterceptor is declared on.
 

Method Detail

handle

Object handle(Object command,
              UnitOfWork unitOfWork,
              InterceptorChain interceptorChain)
              throws Throwable
The handle method is invoked each time a command is dispatched through the event bus that the CommandHandlerInterceptor is declared on. The incoming command and contextual information can be found in the given commandContext.

The interceptor is responsible for the continuation of the dispatch process by invoking the InterceptorChain.proceed(Object) method on the given interceptorChain.

Any information gathered by interceptors may be attached to the command context. 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.

Parameters:
command - The command being dispatched
unitOfWork - The UnitOfWork in which
interceptorChain - The interceptor chain that allows this interceptor to proceed the dispatch process
Returns:
the result of the command handler. May have been modified by interceptors.
Throws:
Throwable - any exception that occurs while handling the command


Copyright © 2011. All Rights Reserved.