Class RotatingServerAdvice
java.lang.Object
org.springframework.integration.file.remote.aop.RotatingServerAdvice
- All Implemented Interfaces:
Advice,Interceptor,MethodInterceptor,MessageSourceMutator,ReceiveMessageAdvice
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
ConstructorsConstructorDescriptionRotatingServerAdvice(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 TypeMethodDescriptionMessage<?> afterReceive(Message<?> result, MessageSource<?> source) Subclasses can take actions based on the result of the poll; e.g.booleanbeforeReceive(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, waitMethods inherited from interface org.springframework.integration.aop.MessageSourceMutator
afterReceive, beforeReceiveMethods inherited from interface org.springframework.integration.aop.ReceiveMessageAdvice
invoke
-
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:MessageSourceMutatorSubclasses can decide whether to proceed with this poll.- Specified by:
beforeReceivein interfaceMessageSourceMutator- Parameters:
source- the message source.- Returns:
- true to proceed (default).
-
afterReceive
Description copied from interface:MessageSourceMutatorSubclasses 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:
afterReceivein 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.
-