Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 3.19 KB

File metadata and controls

66 lines (45 loc) · 3.19 KB

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:

Properties grouped by prefix:

sftp.consumer

auto-create-dir

Whether to create the remote directory. (Boolean, default: true)

filename-expression

A SpEL expression to generate the remote file name. (String, default: <none>)

mode

Action to take if the remote file already exists. (FileExistsMode, default: <none>, possible values: APPEND,APPEND_NO_FLUSH,FAIL,IGNORE,REPLACE,REPLACE_IF_MODIFIED)

remote-dir

The remote FTP directory. (String, default: /)

remote-file-separator

The remote file separator. (String, default: /)

temporary-remote-dir

A temporary directory where the file will be written if 'isUseTemporaryFilename()' is true. (String, default: /)

tmp-file-suffix

The suffix to use while the transfer is in progress. (String, default: .tmp)

use-temporary-filename

Whether to write to a temporary file and rename. (Boolean, default: true)

sftp.consumer.factory

allow-unknown-keys

True to allow an unknown or changed key. (Boolean, default: false)

cache-sessions

Cache sessions. (Boolean, default: <none>)

host

The host name of the server. (String, default: localhost)

known-hosts-expression

A SpEL expression resolving to the location of the known hosts file. (Expression, default: <none>)

pass-phrase

Passphrase for user's private key. (String, default: <empty string>)

password

The password to use to connect to the server. (String, default: <none>)

port

The port of the server. (Integer, default: 22)

private-key

Resource location of user's private key. (Resource, default: <none>)

username

The username to use to connect to the server. (String, default: <none>)