Class StandardRotationPolicy
java.lang.Object
org.springframework.integration.file.remote.aop.StandardRotationPolicy
- All Implemented Interfaces:
RotationPolicy
Standard rotation policy; iterates over key/directory pairs; when the end is reached,
starts again at the beginning. If the fair option is true the rotation occurs on every
poll, regardless of result. Otherwise rotation occurs when the current pair returns no
message.
Subclasses implement
onRotation(MessageSource<?> source)
to configure the
MessageSource
on each rotation.- Since:
- 5.2
- Author:
- Gary Russell, Michael Forstner, Artem Bilan, David Turanski
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.file.remote.aop.RotationPolicy
RotationPolicy.KeyDirectory
-
Field Summary
-
Constructor Summary
ConstructorDescriptionStandardRotationPolicy
(DelegatingSessionFactory<?> factory, List<RotationPolicy.KeyDirectory> keyDirectories, boolean fair) -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterReceive
(boolean messageReceived, MessageSource<?> source) Invoked after the message source receive() method.void
beforeReceive
(MessageSource<?> source) Invoked before the message source receive() method.protected void
configureSource
(MessageSource<?> source) Return the currentRotationPolicy.KeyDirectory
.protected DelegatingSessionFactory<?>
protected Iterator<RotationPolicy.KeyDirectory>
protected List<RotationPolicy.KeyDirectory>
protected boolean
isFair()
protected boolean
protected void
onRotation
(MessageSource<?> source) Update the state of theMessageSource
after the server is rotated, if necessary.
-
Field Details
-
logger
-
-
Constructor Details
-
StandardRotationPolicy
public StandardRotationPolicy(DelegatingSessionFactory<?> factory, List<RotationPolicy.KeyDirectory> keyDirectories, boolean fair)
-
-
Method Details
-
beforeReceive
Description copied from interface:RotationPolicy
Invoked before the message source receive() method.- Specified by:
beforeReceive
in interfaceRotationPolicy
- Parameters:
source
- the message source.
-
afterReceive
Description copied from interface:RotationPolicy
Invoked after the message source receive() method.- Specified by:
afterReceive
in interfaceRotationPolicy
- Parameters:
messageReceived
- true if a message was received.source
- the message source.
-
getCurrent
Description copied from interface:RotationPolicy
Return the currentRotationPolicy.KeyDirectory
.- Specified by:
getCurrent
in interfaceRotationPolicy
- Returns:
- the current
RotationPolicy.KeyDirectory
-
getFactory
-
getKeyDirectories
-
isFair
protected boolean isFair() -
getIterator
-
isInitialized
protected boolean isInitialized() -
configureSource
-
onRotation
Update the state of theMessageSource
after the server is rotated, if necessary. The default implementation updates the remote directory for known MessageSource implementations that require it, specifically, instances ofAbstractRemoteFileStreamingMessageSource
, andAbstractInboundFileSynchronizingMessageSource
, and does nothing otherwise. Subclasses may override this method to support other MessageSource types.- Parameters:
source
- the MessageSource.
-