Samples - 6.3

Talend ESB Mediation Developer Guide

EnrichVersion
6.3
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend ESB

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.

protected RouteBuilder createRouteBuilder() throws Exception {
   return new RouteBuilder() {
   public void configure() throws Exception {
      // we use a delay of 60 minutes 
      //(for example, once per hour we poll the FTP server)
      long delay = 60 * 60 * 1000L;

      // from the given FTP server we poll (= download) all the files
      // from the public/reports folder as BINARY types and store this as 
      // files in a local directory. Camel will use the filenames from 
      // the FTPServer. Notice that the FTPConsumer properties must be
      // prefixed with "consumer.". In the URL the delay parameter is  
      // from the FileConsumer component so we should use consumer.delay 
      // as the URI parameter name. The FTP Component is an extension of 
      // the File Component.
      from("ftp://tiger:scott@localhost/public/reports?binary=true&
         consumer.delay=" + delay).to("file://target/test-reports");
      }
   };
}

And the route using Spring DSL:

<route>
   <from uri="ftp://scott@localhost/public/reports?password=
      tiger&amp;binary=true&amp;delay=60000"/>

   <to uri="file://target/test-reports"/>
</route>

Consuming a remote FTPS server (implicit SSL) and client authentication

from(
   "ftps://admin@localhost:2222/public/camel?password=admin
   &securityProtocol=SSL&isImplicit=true
   &ftpClient.keyStore.file=./src/test/resources/server.jks
   &ftpClient.keyStore.password=password
   &ftpClient.keyStore.keyPassword=password").to("bean:foo");

Consuming a remote FTPS server (explicit TLS) and a custom trust store configuration

from("ftps://admin@localhost:2222/public/camel?password=admin&ftpClient.
trustStore.file=./src/test/resources/server.jks&ftpClient.trustStore.
password=password").to("bean:foo");