Class RotatingServerAdvice
java.lang.Object
org.springframework.integration.file.remote.aop.RotatingServerAdvice
- All Implemented Interfaces:
Advice
,Interceptor
,MethodInterceptor
,MessageSourceMutator
,ReceiveMessageAdvice
public class RotatingServerAdvice extends Object implements MessageSourceMutator
A smart poller advice that rotates across multiple remote servers/directories.
- Since:
- 5.0.7
- Author:
- Gary Russell, Michael Forstner, Artem Bilan, David Turanski
-
Constructor Summary
Constructors Constructor Description RotatingServerAdvice(RotationPolicy rotationPolicy)
Construct an instance that rotates according to the suppliedRotationPolicy
.RotatingServerAdvice(DelegatingSessionFactory<?> factory, List<RotationPolicy.KeyDirectory> keyDirectories)
Create an instance that rotates to the next server/directory if no message is received.RotatingServerAdvice(DelegatingSessionFactory<?> factory, List<RotationPolicy.KeyDirectory> keyDirectories, boolean fair)
Create an instance that rotates to the next server/directory depending on the fair argument. -
Method Summary
Modifier and Type Method Description Message<?>
afterReceive(Message<?> result, MessageSource<?> source)
Subclasses can take actions based on the result of the poll; e.g.boolean
beforeReceive(MessageSource<?> source)
Subclasses can decide whether to proceed with this poll.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.integration.aop.MessageSourceMutator
afterReceive, beforeReceive
-
Constructor Details
-
RotatingServerAdvice
public RotatingServerAdvice(DelegatingSessionFactory<?> factory, List<RotationPolicy.KeyDirectory> keyDirectories)Create an instance that rotates to the next server/directory if no message is received.- Parameters:
factory
- theDelegatingSessionFactory
.keyDirectories
- a list ofRotationPolicy.KeyDirectory
.
-
RotatingServerAdvice
public RotatingServerAdvice(DelegatingSessionFactory<?> factory, List<RotationPolicy.KeyDirectory> keyDirectories, boolean fair)Create an instance that rotates to the next server/directory depending on the fair argument.- Parameters:
factory
- theDelegatingSessionFactory
.keyDirectories
- a list ofRotationPolicy.KeyDirectory
.fair
- true to rotate on every poll, false to rotate when no message is received.
-
RotatingServerAdvice
Construct an instance that rotates according to the suppliedRotationPolicy
.- Parameters:
rotationPolicy
- the policy.
-
-
Method Details
-
beforeReceive
Description copied from interface:MessageSourceMutator
Subclasses can decide whether to proceed with this poll.- Specified by:
beforeReceive
in interfaceMessageSourceMutator
- Parameters:
source
- the message source.- Returns:
- true to proceed (default).
-
afterReceive
Description copied from interface:MessageSourceMutator
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.- Specified by:
afterReceive
in interfaceMessageSourceMutator
- 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.
-