//tag::ref-doc[]
= SFTP Sink

SFTP sink is a simple option to push files to an SFTP server from incoming messages.

It uses an `sftp-outbound-adapter`, therefore incoming messages can be either a `java.io.File` object, a `String` (content of the file)
or an array of `bytes` (file content as well).

To use this sink, you need a username and a password to login.

NOTE: By default Spring Integration will use `o.s.i.file.DefaultFileNameGenerator` if none is specified. `DefaultFileNameGenerator` will determine the file name
based on the value of the `file_name` header (if it exists) in the `MessageHeaders`, or if the payload of the `Message` is already a `java.io.File`, then it will
use the original name of that file.

When configuring the `sftp.factory.known-hosts-expression` option, the root object of the evaluation is the application context, an example might be `sftp.factory.known-hosts-expression = @systemProperties['user.home'] + '/.ssh/known_hosts'`.

== Input

=== Headers

* `file_name` (See note above)

=== Payload

* `java.io.File`
* `java.io.InputStream`
* `byte[]`
* `String`

== Output

N/A (writes to the SFTP server).

== Options

The **$$sftp$$** $$sink$$ has the following options:

//tag::configuration-properties[link-to-catalog=true]
https://github.com/spring-cloud/spring-functions-catalog/tree/main/consumer/spring-sftp-consumer#configuration-options[See Spring Functions Catalog for configuration options].
//end::configuration-properties[]

//end::ref-doc[]
