Class FtpConsumer

  • All Implemented Interfaces:
    AdaptrisComponent, AdaptrisMessageConsumer, AdaptrisMessageWorker, ComponentLifecycle, ComponentLifecycleExtension, MessageEventGenerator, StateManagedComponent
    Direct Known Subclasses:
    FtpRecursiveConsumer

    @ComponentProfile(summary="Pickup messages from an FTP or SFTP server",
                      tag="consumer,ftp,ftps,sftp",
                      metadata={"originalname","fsFileSize","fsConsumeDir","_interlokMessageConsumedFrom"},
                      recommended=FileTransferConnection.class)
    public class FtpConsumer
    extends FtpConsumerImpl
    FTP implementation of the AdaptrisMessageConsumer interface.

    The connection type for this consumer should always be a concrete implementation of FileTransferConnection.

    The destination should be in the form in the URL form dictated by the FileTransferConnection flavour or simply the IP Address/DNS name of the target Server. If the URL form is used, then it is possible to override the username, password, and port settings of the server, in all other cases the configuration specified in the FileTransferConnection object will be used.

    In the event the proc-directory is not configured, then after processing the file, it is deleted. If proc-directory is configured, then the remote file will be renamed to this directory

    The configuration of this consumer closely mirrors that of the FsConsumer though it does not, at the moment, share any common hierarchy with a key difference; 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:
    FtpConnection, FileTransferConnection

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

    • Constructor Detail

      • FtpConsumer

        public FtpConsumer()
    • Method Detail

      • accept

        protected boolean accept​(java.lang.String path)
                          throws java.lang.Exception
        Overrides:
        accept in class FtpConsumerImpl
        Throws:
        java.lang.Exception
      • fetchAndProcess

        protected boolean fetchAndProcess​(java.lang.String fullPath)
                                   throws java.lang.Exception
        Specified by:
        fetchAndProcess in class FtpConsumerImpl
        Throws:
        java.lang.Exception
      • getWorkDirectory

        public java.lang.String getWorkDirectory()
        The working directory for the consumer. Files are consumed from here.
      • setWorkDirectory

        public void setWorkDirectory​(java.lang.String workDirectory)
        The working directory for the consumer. Files are consumed from here.
      • getProcDirectory

        public java.lang.String getProcDirectory()
        The directory where files are moved to after processing. If null, the file will be deleted instead.
      • setProcDirectory

        public void setProcDirectory​(java.lang.String procDirectory)
        The directory where files are moved to after processing. If null, the file will be deleted instead.
      • getWipSuffix

        public java.lang.String getWipSuffix()
        The suffix of the file to indicate it is being processed.
      • setWipSuffix

        public void setWipSuffix​(java.lang.String wipSuffix)
        The suffix of the file to indicate it is being processed.