apache-camelcamel-ftpapache-camel-k

Camel K doesnt download files from FTP


I run the below Java Camel route to download new files from the FTP server, but doesn't seem to work. However, it doesn't show any errors too. The app starts with the status

Routes startup summary (total:1 started:1)
[2] 2021-07-22 07:03:45,885 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main)     Started route1 (ftp://user1@ftp.mycompany.com/customer-1)

The FTP route code

// camel-k: language=java

import org.apache.camel.builder.RouteBuilder;

public class FTPDownloader extends RouteBuilder {
  @Override
  public void configure() throws Exception {
    from("ftp://user1@ftp.mycompany.com/customer-1?password=RAW(Password)&delay=5s&delete=true")
        .to("file:///tmp/data").log("downloaded");
  }
}

Note: I have setup the Camel K in local Kind cluster. $ kamel run FTPDownloader.java --dev


Solution

  • The problem seem to be the "passive" mode expected by the ftp server. The app started working once I have configured the passiveMode like below.

    from("ftp://user1@ftp.mycompany.com/customer-1?password=RAW(Password)&delay=5s&delete=true&passiveMode=true")
            .to("file:///tmp/data").log("downloaded");