Class RelaxedFtpConsumer

All Implemented Interfaces:
AdaptrisComponent, AdaptrisMessageConsumer, AdaptrisMessageWorker, ComponentLifecycle, ComponentLifecycleExtension, MessageEventGenerator, StateManagedComponent

@ComponentProfile(summary="Pickup messages from an FTP/SFTP server without renaming the file first", metadata={"originalname","fsFileSize","fsConsumeDir","_interlokMessageConsumedFrom"}, tag="consumer,ftp,ftps,sftp", recommended=FileTransferConnection.class) public class RelaxedFtpConsumer extends FtpConsumerImpl
FTP implementation which does not have any guarantees as to the atomicity of operations.

This differs from the standard FtpConsumer in that it does not attempt to rename the file before attempting to process the file. If you have multiple consumers reading the same directory with the same filter then it will be possible to process a message twice (or twice partially) or any combination thereof. It is not recommended that you use this FtpConsumer unless there are very specific reasons to; e.g. the remote FTP server does not support the RNFR and RNTO command. After consuming the file, it is deleted.

The endpoint should be in the form in the URL form dictated by the FileTransferConnection flavour including the directory from which you wish to consume from. Simply specifying the IP Address or DNS name of the remote ftp server may cause files to be consumed without specifying a subdirectory (which if you are not in an ftp chroot jail might be a very bad thing).

Although multiple file-filters can be configured only filters that work with the filepath will work. Other filter implementations (such as those based on size /last modified) may not work.

See Also:

In the adapter configuration file this class is aliased as relaxed-ftp-consumer which is the preferred alternative to the fully qualified classname when building your configuration.

  • Constructor Details

    • RelaxedFtpConsumer

      public RelaxedFtpConsumer()
      Default Constructor with the following defaults.
      • reacquireLockBetweenMessages is true
  • Method Details

    • fetchAndProcess

      protected boolean fetchAndProcess(String fullPath) throws Exception
      Specified by:
      fetchAndProcess in class FtpConsumerImpl
      Throws:
      Exception
    • olderThanMs

      protected long olderThanMs()
      Overrides:
      olderThanMs in class FtpConsumerImpl
    • getFailOnDeleteFailure

      public Boolean getFailOnDeleteFailure()
      Returns:
      the failOnDeleteFailure
    • setFailOnDeleteFailure

      public void setFailOnDeleteFailure(Boolean b)
      Whether or not an attempt to delete the file after processing should result in an exception if it fails.

      By the time the delete attempt has been made; the file has been processed by the adapter. If the delete fails (for whatever reason), then it will still be possible for the adapter to re-process the file again if it exists upon the next poll trigger. Setting it to be true simply allows you to record an error in the adapter log file.

      Parameters:
      b - the failOnDeleteFailure to set (default false)