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 Details

    • AnnotatedCommandHandlerInterceptor

      public AnnotatedCommandHandlerInterceptor(MessageHandlingMember<T> delegate, T target)
      Initializes annotated command handler interceptor with delegate handler and target on which handler is to be invoked.
      Parameters:
      delegate - delegate command handler interceptor
      target - 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: MessageHandlerInterceptor
      Invoked before a Message is handled by a designated MessageHandler.

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

      The given unitOfWork contains 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:
      handle in interface MessageHandlerInterceptor<T>
      Parameters:
      unitOfWork - The UnitOfWork that is processing the message
      interceptorChain - 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