Class StandardRotationPolicy

java.lang.Object
org.springframework.integration.file.remote.aop.StandardRotationPolicy
All Implemented Interfaces:
RotationPolicy

public class StandardRotationPolicy extends Object implements 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
  • Field Details

    • logger

      protected final org.apache.commons.logging.Log logger
  • Constructor Details

  • Method Details

    • beforeReceive

      public void beforeReceive(org.springframework.integration.core.MessageSource<?> source)
      Description copied from interface: RotationPolicy
      Invoked before the message source receive() method.
      Specified by:
      beforeReceive in interface RotationPolicy
      Parameters:
      source - the message source.
    • afterReceive

      public void afterReceive(boolean messageReceived, org.springframework.integration.core.MessageSource<?> source)
      Description copied from interface: RotationPolicy
      Invoked after the message source receive() method.
      Specified by:
      afterReceive in interface RotationPolicy
      Parameters:
      messageReceived - true if a message was received.
      source - the message source.
    • getCurrent

      public RotationPolicy.KeyDirectory getCurrent()
      Description copied from interface: RotationPolicy
      Return the current RotationPolicy.KeyDirectory.
      Specified by:
      getCurrent in interface RotationPolicy
      Returns:
      the current RotationPolicy.KeyDirectory
    • getFactory

      protected DelegatingSessionFactory<?> getFactory()
    • getKeyDirectories

      protected List<RotationPolicy.KeyDirectory> getKeyDirectories()
    • isFair

      protected boolean isFair()
    • getIterator

      protected Iterator<RotationPolicy.KeyDirectory> getIterator()
    • isInitialized

      protected boolean isInitialized()
    • configureSource

      protected void configureSource(org.springframework.integration.core.MessageSource<?> source)
    • onRotation

      protected void onRotation(org.springframework.integration.core.MessageSource<?> source)
      Update the state of the MessageSource after the server is rotated, if necessary. The default implementation updates the remote directory for known MessageSource implementations that require it, specifically, instances of AbstractRemoteFileStreamingMessageSource, and AbstractInboundFileSynchronizingMessageSource, and does nothing otherwise. Subclasses may override this method to support other MessageSource types.
      Parameters:
      source - the MessageSource.