Class FtpConsumerImpl

    • Field Detail

      • DEFAULT_OLDER_THAN

        protected static final TimeInterval DEFAULT_OLDER_THAN
      • DEFAULT_FILE_FILTER_IMPL

        @Deprecated
        protected static final java.lang.String DEFAULT_FILE_FILTER_IMPL
        Deprecated.
        since 3.11.1 instead.
      • fileFilter

        protected transient java.io.FileFilter fileFilter
    • Constructor Detail

      • FtpConsumerImpl

        public FtpConsumerImpl()
    • Method Detail

      • additionalDebug

        protected boolean additionalDebug()
      • handle

        protected boolean handle​(java.lang.String fileToGet)
      • fetchAndProcess

        protected abstract boolean fetchAndProcess​(java.lang.String fullPath)
                                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • configureWorkDir

        protected java.lang.String configureWorkDir​(java.lang.String path)
      • accept

        protected boolean accept​(java.lang.String path)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • ftpURL

        protected java.lang.String ftpURL()
      • filterExpression

        protected java.lang.String filterExpression()
      • fileFilterImp

        protected java.lang.String fileFilterImp()
      • olderThanMs

        protected long olderThanMs()
      • setQuietInterval

        public void setQuietInterval​(TimeInterval interval)
        Specify the time in which a file has been untouched before it is deemed safe to be processed.

        The purpose of this is to delay processing of files that may be currently being written to by another process. On certain platforms (e.g. most Unix) it is still possible to obtain an exclusive lock on the file even though it is being written to by another process.

        Note: your mileage may vary when using this setting. The FTP Server and the FTP Client will almost certainly have to time-synchronized. Depending on the FTP Server implementation in question, you may need to additionally specify the server's timezone in order to get accurate information.Additionally, the remote FTP server needs to support support the MDTM command.

        Parameters:
        interval - the quietPeriod to set (default to 0)
        See Also:
        FtpConnectionImp.setServerTimezone(String), CompositeFileFilter, setFileFilterImp(String)
      • consumeLocationKey

        public java.lang.String consumeLocationKey()
        Provides the metadata key '"fsConsumeDir"' that contains the directory (if not null) where the file was read from.
        Returns:
        the metadata key;
        Since:
        3.9.0
      • getFileFilterImp

        public java.lang.String getFileFilterImp()
        Set the filename filter implementation that will be used for filtering files.

        The file filter implementation that is used in conjunction with the getFilterExpression(), if not specified, then the default is org.apache.commons.io.filefilter.RegexFileFilter which uses the java.util regular expressions to perform filtering

        The expression that is used to filter messages is derived from getFilterExpression().

        Note that because we working against a remote server, support for additional file attributes such as size (e.g. via SizeGreaterThan) or last modified may not be supported. We encourage you to stick with filtering by filename only.

        See Also:
        getFilterExpression()
      • setFileFilterImp

        public void setFileFilterImp​(java.lang.String fileFilterImp)
        Set the filename filter implementation that will be used for filtering files.

        The file filter implementation that is used in conjunction with the getFilterExpression(), if not specified, then the default is org.apache.commons.io.filefilter.RegexFileFilter which uses the java.util regular expressions to perform filtering

        The expression that is used to filter messages is derived from getFilterExpression().

        Note that because we working against a remote server, support for additional file attributes such as size (e.g. via SizeGreaterThan) or last modified may not be supported. We encourage you to stick with filtering by filename only.

        See Also:
        getFilterExpression()
      • getFtpEndpoint

        public java.lang.String getFtpEndpoint()
        The FTP endpoint where we will retrieve files files.

        Although nominally a URL, you can configure the following styles

        • Just the server name / IP Address (e.g. 10.0.0.1) in which case the username and password from the corresponding FileTransferConnection will be used to supply the username and password. You will be working off directly off the perceived root filesystem which will be a problem if you aren't in a chroot jail.
        • A FTP style URL ftp://10.0.0.1/path/to/dir, the username and password will be taken from the corresponding connection. The working directory start with /path/to/dir
        • A FTP style URL with a username/password ftp://user:password@10.0.0.1/path/to/dir. The working directory will start with /path/to/dir
      • setFtpEndpoint

        public void setFtpEndpoint​(java.lang.String ftpEndpoint)
        The FTP endpoint where we will retrieve files files.

        Although nominally a URL, you can configure the following styles

        • Just the server name / IP Address (e.g. 10.0.0.1) in which case the username and password from the corresponding FileTransferConnection will be used to supply the username and password. You will be working off directly off the perceived root filesystem which will be a problem if you aren't in a chroot jail.
        • A FTP style URL ftp://10.0.0.1/path/to/dir, the username and password will be taken from the corresponding connection. The working directory start with /path/to/dir
        • A FTP style URL with a username/password ftp://user:password@10.0.0.1/path/to/dir. The working directory will start with /path/to/dir
      • getFilterExpression

        public java.lang.String getFilterExpression()
        The filter expression to use when listing files.

        If not specified then will default in a file filter that matches all files.

      • setFilterExpression

        public void setFilterExpression​(java.lang.String filterExpression)
        The filter expression to use when listing files.

        If not specified then will default in a file filter that matches all files.