Class RelaxedFtpConsumer
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageConsumer
,AdaptrisMessageWorker
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,StateManagedComponent
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.adaptris.core.AdaptrisPollingConsumer
AdaptrisPollingConsumer.LockOperator
-
Field Summary
Fields inherited from class com.adaptris.core.ftp.FtpConsumerImpl
DEFAULT_FILE_FILTER_IMPL, DEFAULT_OLDER_THAN, fileFilter, ftpClient
Fields inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
log
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
fetchAndProcess
(String fullPath) protected long
void
Whether or not an attempt to delete the file after processing should result in an exception if it fails.Methods inherited from class com.adaptris.core.ftp.FtpConsumerImpl
accept, additionalDebug, addStandardMetadata, configureWorkDir, consumeLocationKey, fileFilterImp, filterExpression, ftpURL, getFileFilterImp, getFilterExpression, getFtpEndpoint, getQuietInterval, handle, init, oldEnough, prepareConsumer, processMessages, setFileFilterImp, setFilterExpression, setFtpEndpoint, setQuietInterval
Methods inherited from class com.adaptris.core.AdaptrisPollingConsumer
close, continueProcessingMessages, getMaxMessagesPerPoll, getPoller, getReacquireLockBetweenMessages, prepare, releaseLock, setMaxMessagesPerPoll, setPoller, setReacquireLockBetweenMessages, start, stop
Methods inherited from class com.adaptris.core.AdaptrisMessageConsumerImp
changeState, newThreadName, registerAdaptrisMessageListener, renameThread, requestClose, requestInit, requestStart, requestStop, retrieveAdaptrisMessageListener, retrieveComponentState
Methods inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
createName, createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
Methods inherited from interface com.adaptris.core.AdaptrisMessageWorker
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpoint
-
Constructor Details
-
RelaxedFtpConsumer
public RelaxedFtpConsumer()Default Constructor with the following defaults.- reacquireLockBetweenMessages is true
-
-
Method Details
-
fetchAndProcess
- Specified by:
fetchAndProcess
in classFtpConsumerImpl
- Throws:
Exception
-
olderThanMs
protected long olderThanMs()- Overrides:
olderThanMs
in classFtpConsumerImpl
-
getFailOnDeleteFailure
- Returns:
- the failOnDeleteFailure
-
setFailOnDeleteFailure
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)
-