ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Mule : Ftp Provider

Mule : Ftp Provider

原创 Linux操作系统 作者:279531451 时间:2009-09-22 15:24:06 0 删除 编辑

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.

Ftp Connector Properties

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:
  • ${DATE} - the current date in the format dd-MM-yy_HH-mm-ss.SS
  • ${DATE:yy-MM-dd} - the current date using the specified format
  • ${SYSTIME} - The current system time milliseconds
  • ${UUID} - A generated Universally unique id
  • ${ORIGINALNAME} - The original file name if the file being written was read from another location
  • ${COUNT} - An incremental counter
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

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.

Filename Filters

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"/>

Property Overrides

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博客 ” ,链接:http://blog.itpub.net/7551038/viewspace-615318/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-09-01

  • 博文量
    100
  • 访问量
    153933