Class AbstractRemoteFileStreamingMessageSource<F>

Type Parameters:
F - The target protocol file type.
All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, Lifecycle, MessageSource<InputStream>, IntegrationPattern, NamedComponent, IntegrationInboundManagement, IntegrationManagement, ManageableLifecycle, MessageSourceManagement
Direct Known Subclasses:
FtpStreamingMessageSource, SftpStreamingMessageSource, SmbStreamingMessageSource

public abstract class AbstractRemoteFileStreamingMessageSource<F> extends AbstractFetchLimitingMessageSource<InputStream> implements ManageableLifecycle
A message source that produces a message with an InputStream payload referencing a remote file.
Gary Russell, Artem Bilan, Lukas Gemela, Trung Pham
  • Constructor Details

  • Method Details

    • setRemoteDirectory

      public void setRemoteDirectory(String remoteDirectory)
      Specify the full path to the remote directory.
      remoteDirectory - The remote directory.
    • setRemoteDirectoryExpression

      public void setRemoteDirectoryExpression(Expression remoteDirectoryExpression)
      Specify an expression that evaluates to the full path to the remote directory.
      remoteDirectoryExpression - The remote directory expression.
    • setRemoteFileSeparator

      public void setRemoteFileSeparator(String remoteFileSeparator)
      Set the remote file separator; default '/'.
      remoteFileSeparator - the remote file separator.
    • setFilter

      public void setFilter(FileListFilter<F> filter)
      Set the filter to be applied to the remote files before transferring.
      filter - the file list filter.
    • doSetFilter

      protected final void doSetFilter(FileListFilter<F> filterToSet)
    • setFileInfoJson

      public void setFileInfoJson(boolean fileInfoJson)
      Set to false to add the FileHeaders.REMOTE_FILE_INFO header to the raw FileInfo. Default is true meaning that common file information properties are provided in that header as JSON.
      fileInfoJson - false to set the raw object.
    • setStrictOrder

      public void setStrictOrder(boolean strictOrder)
      The flag indicating if the local cache has to be fully clear on failure to preserve a processing order of remote files on the next AbstractMessageSource.receive() attempt. By default, only the failed file will be re-fetched from remote directory, but only when local cache is already empty, essential out of order.
      strictOrder - if cached files has to be cleared on failure.
    • getRemoteFileTemplate

      protected RemoteFileTemplate<? extends F> getRemoteFileTemplate()
    • onInit

      public final void onInit()
      onInit in class AbstractExpressionEvaluator
    • doInit

      protected void doInit()
      Subclasses can override to perform initialization - called from InitializingBean.afterPropertiesSet().
    • start

      public void start()
      Specified by:
      start in interface Lifecycle
      Specified by:
      start in interface ManageableLifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface Lifecycle
      Specified by:
      stop in interface ManageableLifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface Lifecycle
      Specified by:
      isRunning in interface ManageableLifecycle
    • doReceive

      protected Object doReceive(int maxFetchSize)
      Description copied from class: AbstractFetchLimitingMessageSource
      Subclasses must implement this method. Typically the returned value will be the payload of type T, but the returned value may also be a Message instance whose payload is of type T.
      Specified by:
      doReceive in class AbstractFetchLimitingMessageSource<InputStream>
      maxFetchSize - the maximum number of messages to fetch if a fetch is necessary.
      The value returned.
    • poll

      protected AbstractFileInfo<F> poll()
    • remotePath

      protected String remotePath(AbstractFileInfo<F> file)
    • rollbackFromFileToListEnd

      protected void rollbackFromFileToListEnd(List<F> filteredFiles, F file)
    • asFileInfoList

      protected abstract List<AbstractFileInfo<F>> asFileInfoList(Collection<F> files)
    • isDirectory

      protected abstract boolean isDirectory(F file)