Interface MessageSourceMutator

All Superinterfaces:
Advice, Interceptor, MethodInterceptor, ReceiveMessageAdvice
All Known Implementing Classes:
CompoundTriggerAdvice, RotatingServerAdvice
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 MessageSourceMutator extends ReceiveMessageAdvice
A ReceiveMessageAdvice extension that can mutate a MessageSource before and/or after MessageSource.receive() is called.
Since:
5.0.7
Author:
Gary Russell, Artem Bilan
  • Method Details

    • beforeReceive

      default boolean beforeReceive(Object source)
      Description copied from interface: ReceiveMessageAdvice
      Subclasses can decide whether to Joinpoint.proceed() or not.
      Specified by:
      beforeReceive in interface ReceiveMessageAdvice
      Parameters:
      source - the source of the message to receive.
      Returns:
      true to proceed (default).
    • beforeReceive

      default boolean beforeReceive(MessageSource<?> source)
      Subclasses can decide whether to proceed with this poll.
      Parameters:
      source - the message source.
      Returns:
      true to proceed (default).
    • afterReceive

      @Nullable default Message<?> afterReceive(@Nullable Message<?> result, Object source)
      Description copied from interface: ReceiveMessageAdvice
      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.
      Specified by:
      afterReceive in interface ReceiveMessageAdvice
      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.
    • afterReceive

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