blob: fb5d46f85ba12f2730f21328102e7ec8e30ce890 [file] [log] [blame]
h2. servicemix-ftp
h3. Overview
The ServiceMix FTP component provides JBI integration to the FTP servers. It can be used to read & write files over FTPor to periodically poll directories for new files.
h4. Namespace and xbean.xml
The namespace URI for the servicemix-bean JBI component is {{http://servicemix.apache.org/ftp/1.0}}. This is an example of an {{xbean.xml}} file with a namespace definition with prefix {{bean}}.
{pygmentize:lang=xml}
<beans xmlns:ftp="http://servicemix.apache.org/ftp/1.0">
<!-- add ftp:poller and ftp:sender definitions here -->
</beans>
{pygmentize}
h4. Endpoint types
The servicemix-ftp component defines two endpoint type:
- {{ftp:poller}} :: Periodically polls a directory on an FTP server for files and sends an exchange for every file
- {{ftp:sender}} :: Writes the contents of an exchange to a file on an FTP server
h3. {{ftp:poller}}
h4. Endpoint properties
{include:jbi/components/_servicemix-ftp-poller.conf}
h3. {{ftp:sender}}
h4. Endpoint properties
{include:jbi/components/_servicemix-ftp-sender.conf}
h3. Examples
h4. Using {{ftp:pool}} to configure the FTP connections
In order to gain more control over the FTP connection parameters (active/passive, timeout, ...) that are being used, you can define your own FTP connection pool. Afterward, you can refer to the pool object from both a sender and poller endpoint.
{pygmentize:lang=xml}
<?xml version="1.0"?>
<beans xmlns:ftp="http://servicemix.apache.org/ftp/1.0"
xmlns:sample="urn:servicemix:example">
<ftp:sender service="sample:sender" endpoint="endpoint"
uri="ftp://localhost/myfolder"
clientPool="#clientPool"/>
<ftp:pool id="clientPool" username="myname" password="$ecret"
dataTimeout="90000" />
</beans>
{pygmentize}
The table below shows the full list of options offered by {{ftp:pool}}:
{include:jbi/components/_servicemix-ftp-pool.conf}
If you need even more fine-grained control over the FTP connections or the way the payloads are being handled, have a look at the [Camel FTP|http://camel.apache.org/ftp2.html] component, which offers a lot of options out of the box, but also allows setting any property on its underlying Commons NET [FTPClient|http://commons.apache.org/net/api/org/apache/commons/net/ftp/FTPClient.html] and [FTPClientConfig|http://commons.apache.org/net/api/org/apache/commons/net/ftp/FTPClientConfig.html] instances.