Class CorrelationDataInterceptor<T extends Message<?>>
java.lang.Object
org.axonframework.messaging.interceptors.CorrelationDataInterceptor<T>
- Type Parameters:
T- The type of Message that can be intercepted
- All Implemented Interfaces:
MessageHandlerInterceptor<T>
public class CorrelationDataInterceptor<T extends Message<?>>
extends Object
implements MessageHandlerInterceptor<T>
Message interceptor that registers
CorrelationDataProviders with the Unit of Work.
The registered CorrelationDataProviders copy correlation MetaData over from the Message processed by the Unit of Work
to new Messages that are created during processing.- Since:
- 3.0
- Author:
- Rene de Waele
-
Constructor Summary
ConstructorsConstructorDescriptionCorrelationDataInterceptor(Collection<CorrelationDataProvider> correlationDataProviders) Initializes the interceptor that registers givencorrelationDataProviderswith the current Unit of Work.CorrelationDataInterceptor(CorrelationDataProvider... correlationDataProviders) Initializes the interceptor that registers givencorrelationDataProviderswith the current Unit of Work. -
Method Summary
Modifier and TypeMethodDescriptionhandle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) Invoked before a Message is handled by a designatedMessageHandler.
-
Constructor Details
-
CorrelationDataInterceptor
Initializes the interceptor that registers givencorrelationDataProviderswith the current Unit of Work.- Parameters:
correlationDataProviders- The CorrelationDataProviders to register with the Interceptor
-
CorrelationDataInterceptor
Initializes the interceptor that registers givencorrelationDataProviderswith the current Unit of Work.- Parameters:
correlationDataProviders- The CorrelationDataProviders to register with the Interceptor
-
-
Method Details
-
handle
public Object handle(@Nonnull UnitOfWork<? extends T> unitOfWork, @Nonnull InterceptorChain interceptorChain) throws Exception Description copied from interface:MessageHandlerInterceptorInvoked 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.- Specified by:
handlein interfaceMessageHandlerInterceptor<T extends Message<?>>- 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
-