Interface MessageSourceMutator
- All Superinterfaces:
org.aopalliance.aop.Advice
,org.aopalliance.intercept.Interceptor
,org.aopalliance.intercept.MethodInterceptor
,ReceiveMessageAdvice
- All Known Implementing Classes:
AbstractMessageSourceAdvice
,CompoundTriggerAdvice
,SimpleActiveIdleMessageSourceAdvice
- 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
-
Method Summary
Modifier and Type Method Description default 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.org.springframework.messaging.Message<?>
afterReceive(org.springframework.messaging.Message<?> result, MessageSource<?> source)
Subclasses can take actions based on the result of the poll; e.g.default boolean
beforeReceive(java.lang.Object source)
Subclasses can decide whether toJoinpoint.proceed()
or not.default boolean
beforeReceive(MessageSource<?> source)
Subclasses can decide whether to proceed with this poll.
-
Method Details
-
beforeReceive
default boolean beforeReceive(java.lang.Object source)Description copied from interface:ReceiveMessageAdvice
Subclasses can decide whether toJoinpoint.proceed()
or not.- Specified by:
beforeReceive
in interfaceReceiveMessageAdvice
- Parameters:
source
- the source of the message to receive.- Returns:
- true to proceed (default).
-
beforeReceive
Subclasses can decide whether to proceed with this poll.- Parameters:
source
- the message source.- Returns:
- true to proceed (default).
-
afterReceive
@Nullable default org.springframework.messaging.Message<?> afterReceive(@Nullable org.springframework.messaging.Message<?> result, java.lang.Object source)Description copied from interface:ReceiveMessageAdvice
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.- Specified by:
afterReceive
in interfaceReceiveMessageAdvice
- 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 org.springframework.messaging.Message<?> afterReceive(@Nullable org.springframework.messaging.Message<?> result, MessageSource<?> source)Subclasses can take actions based on the result of the poll; e.g. adjust thetrigger
. 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.
-