Allows manipulating files through the FTP and SFTP
Configurations
Config
Default configuration
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Name |
String |
The name for this configuration. Connectors reference the configuration with this name. |
x |
|
Connection |
The connection types that can be provided to this configuration. |
x |
||
Expiration Policy |
Configures the minimum amount of time that a dynamic configuration instance can remain idle before the runtime considers it eligible for expiration. This does not mean that the platform will expire the instance at the exact moment that it becomes eligible. The runtime will actually purge the instances when it sees it fit. |
|
Connection Types
SFTP Connection
An FileSystemProvider which provides instances of SftpFileSystem from instances of SftpConnector
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Working Directory |
String |
The directory to be considered as the root of every relative path used with this connector. If not provided, it will default to the remote server default. |
|
|
Preferred Authentication Methods |
Array of Enumeration, one of:
|
Set of authentication methods used by the SFTP client. Valid values are: gssapi-with-mic, publickey, keyboard-interactive and password. |
|
|
Known Hosts File |
String |
If provided, the client will validate the server's key against the one in the referenced file. If the server key doesn't match the one in the file, the connection will be aborted. |
|
|
Sftp Proxy Config |
If provided, a proxy will be used for the connection. |
|
||
Connection Timeout |
Number |
A scalar value representing the amount of time to wait before a connection attempt times out. This attribute works in tandem with #connectionTimeoutUnit. Defaults to 10 |
10 |
|
Connection Timeout Unit |
Enumeration, one of:
|
A TimeUnit which qualifies the #connectionTimeout attribute. Defaults to SECONDS |
SECONDS |
|
Response Timeout |
Number |
A scalar value representing the amount of time to wait before a request for data times out. This attribute works in tandem with #responseTimeoutUnit. Defaults to 10 |
10 |
|
Response Timeout Unit |
Enumeration, one of:
|
A TimeUnit which qualifies the #responseTimeoutUnit attribute. Defaults to SECONDS |
SECONDS |
|
Host |
String |
The FTP server host, such as www.mulesoft.com, localhost, or 192.168.0.1, etc |
x |
|
Port |
Number |
The port number of the SFTP server to connect on |
22 |
|
Username |
String |
Username for the FTP Server. Required if the server is authenticated. |
|
|
Password |
String |
Password for the FTP Server. Required if the server is authenticated. |
|
|
Passphrase |
String |
The passphrase (password) for the identityFile if required. Notice that this parameter is ignored if #identityFile is not provided |
|
|
Identity File |
String |
An identityFile location for a PKI private key. |
|
|
Reconnection |
When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment will fail if the test doesn't pass after exhausting the associated reconnection strategy |
|
||
Pooling Profile |
Characteristics of the connection pool |
|
Operations
Copy
<sftp:copy>
Copies the file at the sourcePath into the targetPath.
If targetPath doesn't exist, and neither does its parent, then an attempt will be made to create depending on the value of the createParentFolder argument. If such argument is , then an IllegalArgumentException will be thrown.
If the target file already exists, then it will be overwritten if the overwrite argument is true. Otherwise, IllegalArgumentException will be thrown.
As for the sourcePath, it can either be a file or a directory. If it points to a directory, then it will be copied recursively.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Source Path |
String |
the path to the file to be copied |
|
|
Target Path |
String |
the target directory where the file is going to be copied |
x |
|
Create Parent Directories |
Boolean |
whether or not to attempt creating any parent directories which don't exists. |
true |
|
Overwrite |
Boolean |
whether or not overwrite the file if the target destination already exists. |
false |
|
Rename To |
String |
copied file's new name. If not provided, original file name will be kept. |
|
|
Reconnection Strategy |
A retry strategy in case of connectivity errors |
|
For Configurations.
Throws
-
SFTP:RETRY_EXHAUSTED
-
SFTP:FILE_ALREADY_EXISTS
-
SFTP:ILLEGAL_PATH
-
SFTP:CONNECTIVITY
Create Directory
<sftp:create-directory>
Creates a new directory on directoryPath
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Directory Path |
String |
the new directory's name |
x |
|
Reconnection Strategy |
A retry strategy in case of connectivity errors |
|
For Configurations.
Throws
-
SFTP:RETRY_EXHAUSTED
-
SFTP:FILE_ALREADY_EXISTS
-
SFTP:ILLEGAL_PATH
-
SFTP:CONNECTIVITY
-
SFTP:ACCESS_DENIED
Delete
<sftp:delete>
Deletes the file pointed by path, provided that it's not locked
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Path |
String |
the path to the file to be deleted |
|
|
Reconnection Strategy |
A retry strategy in case of connectivity errors |
|
For Configurations.
Throws
-
SFTP:RETRY_EXHAUSTED
-
SFTP:ILLEGAL_PATH
-
SFTP:CONNECTIVITY
-
SFTP:ACCESS_DENIED
List
<sftp:list>
Lists all the files in the directoryPath which match the given matcher.
If the listing encounters a directory, the output list will include its contents depending on the value of the recursive parameter.
If recursive is set to true but a found directory is rejected by the matcher, then there won't be any recursion into such directory. attributes
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Directory Path |
String |
the path to the directory to be listed |
x |
|
Recursive |
Boolean |
whether to include the contents of sub-directories. Defaults to false. |
false |
|
File Matching Rules |
a matcher used to filter the output list |
|
||
Target Variable |
String |
The name of a variable on which the operation's output will be placed |
|
|
Target Value |
String |
An expression that will be evaluated against the operation's output and the outcome of that expression will be stored in the target variable |
#[payload] |
|
Reconnection Strategy |
A retry strategy in case of connectivity errors |
|
Output
Type |
Array of Message of [Binary] payload and [Sftp File Attributes] attributes |
For Configurations.
Throws
-
SFTP:RETRY_EXHAUSTED
-
SFTP:ILLEGAL_PATH
-
SFTP:CONNECTIVITY
-
SFTP:ACCESS_DENIED
Move
<sftp:move>
Moves the file at the sourcePath into the targetPath.
If targetPath doesn't exist, and neither does its parent, then an attempt will be made to create depending on the value of the createParentFolder argument. If such argument is false, then an IllegalArgumentException will be thrown.
If the target file already exists, then it will be overwritten if the overwrite argument is true. Otherwise, IllegalArgumentException will be thrown.
As for the sourcePath, it can either be a file or a directory. If it points to a directory, then it will be moved recursively.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Source Path |
String |
the path to the file to be copied |
|
|
Target Path |
String |
the target directory |
x |
|
Create Parent Directories |
Boolean |
whether or not to attempt creating any parent directories which don't exists. |
true |
|
Overwrite |
Boolean |
whether or not overwrite the file if the target destination already exists. |
false |
|
Rename To |
String |
moved file's new name. If not provided, original file name will be kept. |
|
|
Reconnection Strategy |
A retry strategy in case of connectivity errors |
|
For Configurations.
Throws
-
SFTP:RETRY_EXHAUSTED
-
SFTP:FILE_ALREADY_EXISTS
-
SFTP:ILLEGAL_PATH
-
SFTP:CONNECTIVITY
Read
<sftp:read>
Obtains the content and metadata of a file at a given path. The operation itself returns a Message which payload is a InputStream with the file's content, and the metadata is represent as a SftpFileAttributes object that's placed as the message Message#getAttributes() attributes.
If the lock parameter is set to true, then a file system level lock will be placed on the file until the input stream this operation returns is closed or fully consumed. Because the lock is actually provided by the host file system, its behavior might change depending on the mounted drive and the operation system on which mule is running. Take that into consideration before blindly relying on this lock.
This method also makes a best effort to determine the mime type of the file being read. A MimetypesFileTypeMap will be used to make an educated guess on the file's mime type. The user also has the chance to force the output encoding and mimeType through the outputEncoding and outputMimeType optional parameters.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
File Path |
String |
the path to the file to be read |
x |
|
Lock |
Boolean |
whether or not to lock the file. Defaults to false. |
false |
|
Output Mime Type |
String |
The mime type of the payload that this operation outputs. |
|
|
Output Encoding |
String |
The encoding of the payload that this operation outputs. |
|
|
Streaming Strategy |
Configure if repeatable streams should be used and their behaviour |
|
||
Target Variable |
String |
The name of a variable on which the operation's output will be placed |
|
|
Target Value |
String |
An expression that will be evaluated against the operation's output and the outcome of that expression will be stored in the target variable |
#[payload] |
|
Reconnection Strategy |
A retry strategy in case of connectivity errors |
|
Output
Type |
Binary |
Attributes Type |
For Configurations.
Throws
-
SFTP:FILE_LOCK
-
SFTP:RETRY_EXHAUSTED
-
SFTP:ILLEGAL_PATH
-
SFTP:CONNECTIVITY
-
SFTP:ACCESS_DENIED
Rename
<sftp:rename>
Renames the file pointed by path to the name provided on the to parameter
to argument should not contain any path separator. IllegalArgumentException will be thrown if this precondition is not honored.
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Path |
String |
the path to the file to be renamed |
|
|
New Name |
String |
the file's new name |
x |
|
Overwrite |
Boolean |
whether or not overwrite the file if the target destination already exists. |
false |
|
Reconnection Strategy |
A retry strategy in case of connectivity errors |
|
For Configurations.
Throws
-
SFTP:RETRY_EXHAUSTED
-
SFTP:FILE_ALREADY_EXISTS
-
SFTP:ILLEGAL_PATH
-
SFTP:CONNECTIVITY
-
SFTP:ACCESS_DENIED
Write
<sftp:write>
Writes the content into the file pointed by path.
If the directory on which the file is attempting to be written doesn't exist, then the operation will either throw IllegalArgumentException or create such folder depending on the value of the createParentDirectory.
If the file itself already exists, then the behavior depends on the supplied mode.
This operation also supports locking support depending on the value of the lock argument, but following the same rules and considerations as described in the read operation. not set, then it defaults to FileConnectorConfig#getDefaultWriteEncoding()
Parameters
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
Configuration |
String |
The name of the configuration to use. |
x |
|
Path |
String |
the path of the file to be written |
x |
|
Content |
Binary |
the content to be written into the file. Defaults to the current Message payload |
#[payload] |
|
Encoding |
String |
when content is a String, this attribute specifies the encoding to be used when writing. If |
|
|
Create Parent Directories |
Boolean |
whether or not to attempt creating any parent directories which don't exists. |
true |
|
Lock |
Boolean |
whether or not to lock the file. Defaults to false |
false |
|
Write Mode |
Enumeration, one of:
|
a FileWriteMode. Defaults to OVERWRITE |
OVERWRITE |
|
Reconnection Strategy |
A retry strategy in case of connectivity errors |
|
For Configurations.
Throws
-
SFTP:RETRY_EXHAUSTED
-
SFTP:FILE_ALREADY_EXISTS
-
SFTP:ILLEGAL_CONTENT
-
SFTP:ILLEGAL_PATH
-
SFTP:CONNECTIVITY
-
SFTP:ACCESS_DENIED
Types
Sftp Proxy Config
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Host |
String |
x |
||
Port |
Number |
x |
||
Username |
String |
|||
Password |
String |
|||
Protocol |
Enumeration, one of:
|
x |
Reconnection
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Fails Deployment |
Boolean |
When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment will fail if the test doesn’t pass after exhausting the associated reconnection strategy |
||
Reconnection Strategy |
The reconnection strategy to use |
Reconnect
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Frequency |
Number |
How often (in ms) to reconnect |
||
Count |
Number |
How many reconnection attempts to make |
Reconnect Forever
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Frequency |
Number |
How often (in ms) to reconnect |
Pooling Profile
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Max Active |
Number |
Controls the maximum number of Mule components that can be borrowed from a session at one time. When set to a negative value, there is no limit to the number of components that may be active at one time. When maxActive is exceeded, the pool is said to be exhausted. |
||
Max Idle |
Number |
Controls the maximum number of Mule components that can sit idle in the pool at any time. When set to a negative value, there is no limit to the number of Mule components that may be idle at one time. |
||
Max Wait |
Number |
Specifies the number of milliseconds to wait for a pooled component to become available when the pool is exhausted and the exhaustedAction is set to WHEN_EXHAUSTED_WAIT. |
||
Min Eviction Millis |
Number |
Determines the minimum amount of time an object may sit idle in the pool before it is eligible for eviction. When non-positive, no objects will be evicted from the pool due to idle time alone. |
||
Eviction Check Interval Millis |
Number |
Specifies the number of milliseconds between runs of the object evictor. When non-positive, no object evictor is executed. |
||
Exhausted Action |
Enumeration, one of:
|
Specifies the behavior of the Mule component pool when the pool is exhausted. Possible values are: "WHEN_EXHAUSTED_FAIL", which will throw a NoSuchElementException, "WHEN_EXHAUSTED_WAIT", which will block by invoking Object.wait(long) until a new or idle object is available, or WHEN_EXHAUSTED_GROW, which will create a new Mule instance and return it, essentially making maxActive meaningless. If a positive maxWait value is supplied, it will block for at most that many milliseconds, after which a NoSuchElementException will be thrown. If maxThreadWait is a negative value, it will block indefinitely. |
||
Initialisation Policy |
Enumeration, one of:
|
Determines how components in a pool should be initialized. The possible values are: INITIALISE_NONE (will not load any components into the pool on startup), INITIALISE_ONE (will load one initial component into the pool on startup), or INITIALISE_ALL (will load all components in the pool on startup) |
||
Disabled |
Boolean |
Whether pooling should be disabled |
Expiration Policy
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Max Idle Time |
Number |
A scalar time value for the maximum amount of time a dynamic configuration instance should be allowed to be idle before it’s considered eligible for expiration |
||
Time Unit |
Enumeration, one of:
|
A time unit that qualifies the maxIdleTime attribute |
Sftp File Attributes
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Directory |
Boolean |
|||
Name |
String |
|||
Path |
String |
|||
Regular File |
Boolean |
|||
Size |
Number |
|||
Symbolic Link |
Boolean |
|||
Timestamp |
DateTime |
Matcher
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Timestamp Since |
DateTime |
|||
Timestamp Until |
DateTime |
|||
Filename Pattern |
String |
|||
Path Pattern |
String |
|||
Directories |
Enumeration, one of:
|
INCLUDE |
||
Regular Files |
Enumeration, one of:
|
INCLUDE |
||
Sym Links |
Enumeration, one of:
|
INCLUDE |
||
Min Size |
Number |
|||
Max Size |
Number |
Repeatable In Memory Stream
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Initial Buffer Size |
Number |
This is the amount of memory that will be allocated in order to consume the stream and provide random access to it. If the stream contains more data than can be fit into this buffer, then it will be expanded by according to the bufferSizeIncrement attribute, with an upper limit of maxInMemorySize. |
||
Buffer Size Increment |
Number |
This is by how much will be buffer size by expanded if it exceeds its initial size. Setting a value of zero or lower will mean that the buffer should not expand, meaning that a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised when the buffer gets full. |
||
Max Buffer Size |
Number |
This is the maximum amount of memory that will be used. If more than that is used then a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised. A value lower or equal to zero means no limit. |
||
Buffer Unit |
Enumeration, one of:
|
The unit in which all these attributes are expressed |
Repeatable File Store Stream
Field | Type | Description | Default Value | Required |
---|---|---|---|---|
Max In Memory Size |
Number |
Defines the maximum memory that the stream should use to keep data in memory. If more than that is consumed then it will start to buffer the content on disk. |
||
Buffer Unit |
Enumeration, one of:
|
The unit in which maxInMemorySize is expressed |