Annotation Interface MessageHandlerInterceptor


@MessageHandler @Retention(RUNTIME) @Target({METHOD,ANNOTATION_TYPE}) public @interface MessageHandlerInterceptor
Annotation marking a handler method as an interceptor handler. Unlike regular handlers, interceptor handlers are chained and do not block processing by other handlers. They can be used to add processing behavior either before, after or both before and after processing of other handlers.

When parameters of an interceptor do not match the message, this will prevent the invocation of this handler, but it will not block processing of any other handlers that do match.

Since:
4.4.0
Author:
Allard Buijze
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<? extends Message>
    Specifies the type of message that can be handled by the member method.
    Specifies the type of message payload that can be handled by the member method.
  • Element Details

    • messageType

      Class<? extends Message> messageType
      Specifies the type of message that can be handled by the member method. Defaults to any Message.
      Returns:
      The type of Message handled by function annotated with @MessageHandlerInterceptor.
      Default:
      org.axonframework.messaging.core.Message.class
    • payloadType

      Class<?> payloadType
      Specifies the type of message payload that can be handled by the member method. The payload of the message should be assignable to this type. Defaults to any Object.
      Returns:
      The type of Message.payload() handled by the function annotated with @MessageHandlerInterceptor.
      Default:
      java.lang.Object.class