Class RotatingServerAdvice
java.lang.Object
org.springframework.integration.file.remote.aop.RotatingServerAdvice
- All Implemented Interfaces:
org.aopalliance.aop.Advice,org.aopalliance.intercept.Interceptor,org.aopalliance.intercept.MethodInterceptor,org.springframework.integration.aop.MessageSourceMutator,org.springframework.integration.aop.ReceiveMessageAdvice
public class RotatingServerAdvice
extends java.lang.Object
implements org.springframework.integration.aop.MessageSourceMutator
A smart poller advice that rotates across multiple remote servers/directories.
- Since:
- 5.0.7
-
Constructor Summary
Constructors Constructor Description RotatingServerAdvice(RotationPolicy rotationPolicy)Construct an instance that rotates according to the suppliedRotationPolicy.RotatingServerAdvice(DelegatingSessionFactory<?> factory, java.util.List<RotationPolicy.KeyDirectory> keyDirectories)Create an instance that rotates to the next server/directory if no message is received.RotatingServerAdvice(DelegatingSessionFactory<?> factory, java.util.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 org.springframework.messaging.Message<?>afterReceive(org.springframework.messaging.Message<?> result, org.springframework.integration.core.MessageSource<?> source)booleanbeforeReceive(org.springframework.integration.core.MessageSource<?> source)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
RotatingServerAdvice
public RotatingServerAdvice(DelegatingSessionFactory<?> factory, java.util.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, java.util.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
public boolean beforeReceive(org.springframework.integration.core.MessageSource<?> source)- Specified by:
beforeReceivein interfaceorg.springframework.integration.aop.MessageSourceMutator
-
afterReceive
@Nullable public org.springframework.messaging.Message<?> afterReceive(@Nullable org.springframework.messaging.Message<?> result, org.springframework.integration.core.MessageSource<?> source)- Specified by:
afterReceivein interfaceorg.springframework.integration.aop.MessageSourceMutator
-