Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: autoCreate​=true for camel 2.16 is handled correctly for ftp consumers

...

Where directoryname represents the underlying directory. The directory name is a relative path. Absolute path's is not supported. The relative path can contain nested folders, such as /inbox/us.

For Camel versions before Camel 2.16, the The directoryName must exist already as this component does not support the autoCreate option (which the file component does). The reason is that its the FTP administrator (FTP server) task to properly setup user accounts, and home directories with the right file permissions etc.

For Camel 2.16, autoCreate option is supported. When consumer starts, before polling is scheduled, there's additional FTP operation performed to create the directory configured for endpoint. The default value for autoCreate is true.

If no username is provided, then anonymous login is attempted using no password.
If no port number is provided, Camel will provide default values according to the protocol (ftp = 21, sftp = 22, ftps = 2222).

...

In the sample below we set up Camel to download all the reports from the FTP server once every hour (60 min) as BINARY content and store it as files on the local file system.

Wiki Markup
{snippet:id=e1|lang=java|url=camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java}
And the route using Spring DSL:

...

In the sample we have built our own filter that only accepts files starting with report in the filename.

Wiki Markup
{snippet:id=e1|lang=java|url=camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterTest.java}
And then we can configure our route using the filter attribute to reference our filter (using # notation) that we have defined in the spring XML file:

...

The sample below demonstrates how to use it:

Wiki Markup
{snippet:id=example|lang=xml|url=camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest-context.xml}

Using a proxy with SFTP

To use an HTTP proxy to connect to your remote host, you can configure your route in the following way:

...