Interface ReceiveMessageAdvice

All Superinterfaces:
Advice, Interceptor, MethodInterceptor
All Known Subinterfaces:
MessageSourceMutator
All Known Implementing Classes:
CompoundTriggerAdvice, RotatingServerAdvice, SimpleActiveIdleReceiveMessageAdvice
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ReceiveMessageAdvice extends MethodInterceptor
An AOP advice to perform hooks before and/or after a receive() contract is called.
Since:
5.3
Author:
Artem Bilan
  • Method Details

    • beforeReceive

      default boolean beforeReceive(Object source)
      Subclasses can decide whether to Joinpoint.proceed() or not.
      Parameters:
      source - the source of the message to receive.
      Returns:
      true to proceed (default).
    • invoke

      default @Nullable Object invoke(MethodInvocation invocation) throws Throwable
      Specified by:
      invoke in interface MethodInterceptor
      Throws:
      Throwable
    • afterReceive

      @Nullable Message<?> afterReceive(@Nullable Message<?> result, Object source)
      Subclasses can take actions based on the result of the Joinpoint.proceed(); e.g. adjust the trigger. The message can also be replaced with a new one.
      Parameters:
      result - the received message.
      source - the source of the message to receive.
      Returns:
      a message to continue to process the result, null to discard whatever the Joinpoint.proceed() returned.