Class RelaxedFtpConsumer
- java.lang.Object
-
- com.adaptris.core.AdaptrisMessageWorkerImp
-
- com.adaptris.core.AdaptrisMessageConsumerImp
-
- com.adaptris.core.AdaptrisPollingConsumer
-
- com.adaptris.core.ftp.FtpConsumerImpl
-
- com.adaptris.core.ftp.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:
FtpConnection
,FileTransferConnection
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
Constructors Constructor Description RelaxedFtpConsumer()
Default Constructor with the following defaults.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
fetchAndProcess(java.lang.String fullPath)
java.lang.Boolean
getFailOnDeleteFailure()
protected long
olderThanMs()
void
setFailOnDeleteFailure(java.lang.Boolean b)
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
-
-
-
-
Method Detail
-
fetchAndProcess
protected boolean fetchAndProcess(java.lang.String fullPath) throws java.lang.Exception
- Specified by:
fetchAndProcess
in classFtpConsumerImpl
- Throws:
java.lang.Exception
-
olderThanMs
protected long olderThanMs()
- Overrides:
olderThanMs
in classFtpConsumerImpl
-
getFailOnDeleteFailure
public java.lang.Boolean getFailOnDeleteFailure()
- Returns:
- the failOnDeleteFailure
-
setFailOnDeleteFailure
public void setFailOnDeleteFailure(java.lang.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)
-
-