FTP outbound channel adapter
Write messages to a remote FTP directory.
It connects to the FTP server and initiate an FTP transfer for every file it receives in the payload of incoming Messages.
The FTP Outbound Channel Adapter supports the following payloads:
java.io.File
- the actual file object
byte[]
- a byte array that represents the file contents
java.lang.String
- text that represents the file contents
Remote directory
Identifies directory path where file will be transferred to.
e.g., /temp/mytransfers
Mutually exclusive with the remote directory expression setting.
Auto create directory
Specify whether to automatically create the remote target directory if it doesn't exist.
Default is false
.
FTP session factory
FTP session factory that provides the FTP(S) connections for this channel adapter.
Required
Mode
Determines the behaviour of this adapter when the destination file already exists.
Replace (default): If the target file already exists, it will be overwritten.
Append: If append is specified, the data will be appended to the existing file if such file exists, otherwise the new file will be created as usual but, once created, the subsequent data will be appended to it. This attribute is mutually exclusive the use of a temporary file, since append is done to the actual file and not its temporary counterpart. If set to Append, the component will also use an instance of the LockRegistry
to ensure that there are no collisions when multiple threads are writing to the same file.
Append no flush: Same as Append but the data is not flushed or the file closed. This can significantly improve performance at the risk of lost data in the event of a failure. See also flush interval.
Fail: If the target file exists, a MessageHandlingException
is thrown.
Ignore: If the target file exists, the message payload is silently ignored.
Remote filename generator
Specifies a file name generator.
If empty, the default file name generator will be used.
The default generator first checks for a message name in the message header. If no name is available it checks if the Message payload is a File instance, and if so, it uses the same name. Finally, it falls back to the Message ID and adds the suffix '.msg'.
Mutually exclusive with the remote filename generator expression setting.
Remote filename generator expression
Allows you to provide SpEL expression which will compute file name of the remote file (e.g., assuming payload is a java.io.File
: payload.getName() + '.transfered'
).
Mutually exclusive with the remote filename generator setting.
Remote file separator
Allows you to provide remote file/directory separator character.
Default when empty: /
Remote directory expression
Allows you to provide a SpEL expression which will compute the directory path where the files will be transferred to (e.g., headers['remote_dir'] + '/myTransfers'
).
Mutually exclusive with the remote directory setting.
Charset
Character set to be used in case of a String payload.
Default when empty: UTF-8
Use temporary file name
Allows you to suppress using a temporary file name while writing the file by setting this to false.
Default is true
.
Temporary file suffix
Extension used when uploading files. We change it right after we know it's uploaded.
Default is .writing
.
Temporary remote directory
Identifies the remote temporary directory path (e.g., /remote/temp/mytransfers
).
If not specified (the default), the file (with the temporary file suffix) will be uploaded to the remote directory directly.
Mutually exclusive with the temporary remote directory expression setting.
Temporary remote directory expression
Allows you to provide a SpEL expression which will compute the temporary directory path where files will be transferred to before they are moved to the remote directory (e.g., headers['remote_dir'] + '/temp/myTransfers'
).
Mutually exclusive with the temporary remote directory setting.
Advice can be added to change the behaviour of this endpoint, for example to add retry logic in case of failures. The following types of advice are available:
Retry advice: allows configuration of sophisticated retry scenarios; this includes specifying policies for retry attemps, backoff periods between attempts and the recovery strategy when retries are exhausted Circuit breaker: if a certain number of consecutive attempts fails, new requests will fail fast and no attempt will be made to invoke the request handler again until some time has expired Expression evaluating advice: general advice that evaluates a configurable SpEL expression on successful and/or failed attempts, and optionally can send a message to a success channel and/or failure channel
By adding multiple advices to this endpoint you can create even more complex combined behaviour. For example, if you add a circuit breaker and a retry advice, you can create a scenario where the circuit breaker only opens when all retries are exhaused. Note that the order of the advice types is important, as switching the order will change the combined behaviour: the first item in the list will be the top of the advice chain, meaning it will be the last advice that is evaluated. Also note that if any advice "traps" exceptions, all advices higher up in the chain won't know about any failures.
Channel
Channel to consume messages from.
Required
Id
Name that uniquely identifies this flow component.
Required