Interface ReceiveMessageAdvice
- All Superinterfaces:
org.aopalliance.aop.Advice,org.aopalliance.intercept.Interceptor,org.aopalliance.intercept.MethodInterceptor
- All Known Subinterfaces:
MessageSourceMutator
- All Known Implementing Classes:
AbstractMessageSourceAdvice,CompoundTriggerAdvice,SimpleActiveIdleMessageSourceAdvice,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 org.aopalliance.intercept.MethodInterceptor
An AOP advice to perform hooks before and/or after a
receive() contract is called.- Since:
- 5.3
-
Method Summary
Modifier and Type Method Description org.springframework.messaging.Message<?>afterReceive(org.springframework.messaging.Message<?> result, java.lang.Object source)Subclasses can take actions based on the result of theJoinpoint.proceed(); e.g.default booleanbeforeReceive(java.lang.Object source)Subclasses can decide whether toJoinpoint.proceed()or not.default java.lang.Objectinvoke(org.aopalliance.intercept.MethodInvocation invocation)
-
Method Details
-
beforeReceive
default boolean beforeReceive(java.lang.Object source)Subclasses can decide whether toJoinpoint.proceed()or not.- Parameters:
source- the source of the message to receive.- Returns:
- true to proceed (default).
-
invoke
@Nullable default java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws java.lang.Throwable- Specified by:
invokein interfaceorg.aopalliance.intercept.MethodInterceptor- Throws:
java.lang.Throwable
-
afterReceive
@Nullable org.springframework.messaging.Message<?> afterReceive(@Nullable org.springframework.messaging.Message<?> result, java.lang.Object source)Subclasses can take actions based on the result of theJoinpoint.proceed(); e.g. adjust thetrigger. 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.
-