The FTP connector allows files to be read and written to and from remote Ftp servers.
The javadoc for this transport provider can be found here. And the Source Xref can be found here.
| Property | Description | Default | Required |
|---|---|---|---|
| pollingFrequency | The frequency in milliseconds that the read directory should be checked. Not the read directory is specified by the endpoint of the listening component. | 1000 | Yes |
| filenameParser | Is an implementation of org.mule.providers.file.FilenameParser and is used to control how filename patterns are used to generate file names. The file provider has a default implementation called org.mule.providers.file.SimpleFilenameParser that understands the following patterns:
|
org.mule.providers.file. SimpleFilenameParser | Yes |
| outputPattern | The pattern to use when writing a file to disk. This can use the patterns supported by the filenameParser configured for this connector | ${DATE} (If default is used) | Yes |
| passive | Whether to use FTP passive mode (allows to go through firewalls) | true | No |
| binary | Whether to use BINARY or ASCII file types for transfer | true | No |
| validateConnections | Whether to validate FTP connections before use. This takes care of a failed (or restarted) FTP server at the expense of an additional NOOP command packet being sent, but increases overall availability. |
true | No |
Ftp endpoints are expressed using standard Ftp URI syntax -
ftp://: @ /[address]
for example -
ftp://joe:123456@ftp.mycompany.com/~
This will connect to the ftp server at mycompany.com logging in a ser user joe with password 123456 and will work on joe's home directory.
Filters can be set on the endpoint to control what files are received by the endpoint. The filters are expressed in a comma-separated list. To set up a filter to only read .xml and .txt files the following can be used.
"ftp://joe:123456@ftp.mycompany.com/ftp/incoming" >"*.txt,*.xml" className="org.mule.providers.file.filters.FilenameWildcardFilter"/>
You can override certain properties when defining a Ftp endpoints to control the way that endpoint is configured. These properties can be set on the endpoint or the current event.
| Property | Description |
|---|---|
| filename | When dispatching events using an Ftp endpoint the filename property can be used to set the outbound filename. |
| outputPattern | This can be set to an output file pattern using the variables supported on the FilenameParser for this connector (see Connector Properties). If the filename property is set, this will be ignored. |
| pollingFrequency | Controls the polling frequency of the inbound endpoint. This can only be set on the endpoint and will be ignored if set on the event. |
| passive | FTP passive mode is honored on an endpoint level as well. |
| binary | BINARY / ASCII file type. |
For example, to set the output pattern -
"ftp://joe:123456@ftp.mycompany.com/ftp/done" >"outputPattern" value="FtpFile-${DATE}.done"/>
Or to specify the same Endpoint using an URI -
ftp://joe:123456@ftp.mycompany.com/ftp/done?outputPattern=FtpFile-${DATE}.done
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7551038/viewspace-615318/ ,如需转载,请注明出处,否则将追究法律责任。