Package org.axonframework.messaging
Interface MessageHandlerInterceptor<T extends Message<?>>
- Type Parameters:
T- The message type this interceptor can process
- All Known Implementing Classes:
AnnotatedCommandHandlerInterceptor,BeanValidationInterceptor,BeanValidationInterceptor,CorrelationDataInterceptor,LoggingInterceptor,MessageAuthorizationHandlerInterceptor,TransactionManagingInterceptor,UnitOfWorkTimeoutInterceptor
public interface MessageHandlerInterceptor<T extends Message<?>>
Workflow interface that allows for customized message handler invocation chains. A MessageHandlerInterceptor can add
customized behavior to message handler invocations, both before and after the invocation.
- Since:
- 0.5
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptionhandle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) Invoked before a Message is handled by a designatedMessageHandler.
-
Method Details
-
handle
Object handle(@Nonnull UnitOfWork<? extends T> unitOfWork, @Nonnull InterceptorChain interceptorChain) throws Exception Invoked before a Message is handled by a designatedMessageHandler. The interceptor is responsible for the continuation of the handling process by invoking theInterceptorChain.proceed()method on the giveninterceptorChain. The givenunitOfWorkcontains contextual information. Any information gathered by interceptors may be attached to the unitOfWork. Interceptors are highly recommended not to change the type of the message handling result, as the dispatching component might expect a result of a specific type.- Parameters:
unitOfWork- The UnitOfWork that is processing the messageinterceptorChain- The interceptor chain that allows this interceptor to proceed the dispatch process- Returns:
- the result of the message handler. May have been modified by interceptors.
- Throws:
Exception- any exception that occurs while handling the message
-