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 Object
implements org.springframework.integration.aop.MessageSourceMutator
A smart poller advice that rotates across multiple remote servers/directories.
- Since:
- 5.0.7
-
Constructor Summary
ConstructorDescriptionRotatingServerAdvice
(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 TypeMethodDescriptionorg.springframework.messaging.Message<?>
afterReceive
(org.springframework.messaging.Message<?> result, org.springframework.integration.core.MessageSource<?> source) boolean
beforeReceive
(org.springframework.integration.core.MessageSource<?> source) 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
Methods 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
public boolean beforeReceive(org.springframework.integration.core.MessageSource<?> source) - Specified by:
beforeReceive
in 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:
afterReceive
in interfaceorg.springframework.integration.aop.MessageSourceMutator
-