Class FileTransferringMessageHandler<F>

Type Parameters:
F - the file type.
All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Ordered, ExpressionCapable, Orderable, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>
Direct Known Subclasses:
FtpMessageHandler, SftpMessageHandler, SmbMessageHandler

public class FileTransferringMessageHandler<F> extends AbstractMessageHandler
A MessageHandler implementation that transfers files to a remote server.
Since:
2.0
Author:
Iwein Fuld, Mark Fisher, Josh Long, Oleg Zhurakousky, David Turanski, Gary Russell, Artem Bilan
  • Field Details

  • Constructor Details

    • FileTransferringMessageHandler

      public FileTransferringMessageHandler(SessionFactory<F> sessionFactory)
    • FileTransferringMessageHandler

      public FileTransferringMessageHandler(RemoteFileTemplate<F> remoteFileTemplate)
    • FileTransferringMessageHandler

      public FileTransferringMessageHandler(RemoteFileTemplate<F> remoteFileTemplate, FileExistsMode mode)
  • Method Details

    • setAutoCreateDirectory

      public void setAutoCreateDirectory(boolean autoCreateDirectory)
      A boolean flag to indicate automatically create the directory or not.
      Parameters:
      autoCreateDirectory - true to automatically create the directory.
      See Also:
    • setRemoteFileSeparator

      public void setRemoteFileSeparator(String remoteFileSeparator)
      Specify a remote file separator symbol.
      Parameters:
      remoteFileSeparator - the remote file separator.
      See Also:
    • setRemoteDirectoryExpression

      public void setRemoteDirectoryExpression(Expression remoteDirectoryExpression)
      Specify a remote directory path SpEL expression.
      Parameters:
      remoteDirectoryExpression - the remote directory expression
      See Also:
    • setRemoteDirectoryExpressionString

      public void setRemoteDirectoryExpressionString(String remoteDirectoryExpression)
      Specify a remote directory path SpEL expression.
      Parameters:
      remoteDirectoryExpression - the remote directory expression
      Since:
      4.3.13
      See Also:
    • setTemporaryRemoteDirectoryExpression

      public void setTemporaryRemoteDirectoryExpression(Expression temporaryRemoteDirectoryExpression)
      Specify a remote directory path SpEL expression.
      Parameters:
      temporaryRemoteDirectoryExpression - the temporary remote directory expression
      See Also:
    • setTemporaryRemoteDirectoryExpressionString

      public void setTemporaryRemoteDirectoryExpressionString(String temporaryRemoteDirectoryExpression)
      Specify a remote directory path SpEL expression.
      Parameters:
      temporaryRemoteDirectoryExpression - the temporary remote directory expression
      Since:
      4.3.13
      See Also:
    • getTemporaryFileSuffix

      protected String getTemporaryFileSuffix()
    • isUseTemporaryFileName

      protected boolean isUseTemporaryFileName()
    • setUseTemporaryFileName

      public void setUseTemporaryFileName(boolean useTemporaryFileName)
      A boolean flag to use temporary files names or not. Defaults to true.
      Parameters:
      useTemporaryFileName - true to use a temporary file name.
      See Also:
    • setFileNameGenerator

      public void setFileNameGenerator(FileNameGenerator fileNameGenerator)
      Set the file name generator used to generate the remote filename to be used when transferring files to the remote system. Default DefaultFileNameGenerator.
      Parameters:
      fileNameGenerator - the file name generator.
      See Also:
    • setCharset

      public void setCharset(String charset)
      Set the charset to use when converting String payloads to bytes as the content of the remote file. Default UTF-8.
      Parameters:
      charset - the charset.
      See Also:
    • setTemporaryFileSuffix

      public void setTemporaryFileSuffix(String temporaryFileSuffix)
      Set the temporary suffix to use when transferring files to the remote system. Default ".writing".
      Parameters:
      temporaryFileSuffix - the temporary file suffix.
      See Also:
    • setChmodOctal

      public void setChmodOctal(String chmod)
      String setter for Spring XML convenience.
      Parameters:
      chmod - permissions as an octal string e.g "600";
      Since:
      4.3
      See Also:
    • setChmod

      public void setChmod(int chmod)
      Set the file permissions after uploading, e.g. 0600 for owner read/write.
      Parameters:
      chmod - the permissions.
      Since:
      4.3
    • isChmodCapable

      public boolean isChmodCapable()
    • onInit

      protected void onInit()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this for initialization logic.
      Overrides:
      onInit in class IntegrationObjectSupport
    • handleMessageInternal

      protected void handleMessageInternal(Message<?> message)
      Specified by:
      handleMessageInternal in class AbstractMessageHandler
    • doChmod

      protected void doChmod(RemoteFileTemplate<F> remoteFileTemplate, String path, int chmod)
      Set the mode on the remote file after transfer; the default implementation does nothing.
      Parameters:
      remoteFileTemplate - the remote file template.
      path - the path.
      chmod - the chmod to set.
      Since:
      4.3