Class AnnotatedCommandHandlerInterceptor<T>
java.lang.Object
org.axonframework.modelling.command.inspection.AnnotatedCommandHandlerInterceptor<T>
- Type Parameters:
T- The type of entity to which the message handler will delegate the actual handling of the message
- All Implemented Interfaces:
MessageHandlerInterceptor<CommandMessage<?>>
public class AnnotatedCommandHandlerInterceptor<T>
extends Object
implements MessageHandlerInterceptor<CommandMessage<?>>
Annotated command handler interceptor on aggregate. Will invoke the delegate to the real interceptor method.
- Since:
- 3.3
- Author:
- Milan Savic
-
Constructor Summary
ConstructorsConstructorDescriptionAnnotatedCommandHandlerInterceptor(MessageHandlingMember<T> delegate, T target) Initializes annotated command handler interceptor with delegate handler and target on which handler is to be invoked. -
Method Summary
Modifier and TypeMethodDescriptionhandle(UnitOfWork<? extends CommandMessage<?>> unitOfWork, InterceptorChain interceptorChain) Invoked before a Message is handled by a designatedMessageHandler.
-
Constructor Details
-
AnnotatedCommandHandlerInterceptor
Initializes annotated command handler interceptor with delegate handler and target on which handler is to be invoked.- Parameters:
delegate- delegate command handler interceptortarget- on which command handler interceptor is to be invoked
-
-
Method Details
-
handle
public Object handle(@Nonnull UnitOfWork<? extends CommandMessage<?>> 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>- 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
-