我正在尝试使用apache camel从FTP服务器下载csv文件,我尝试了多种方法但尚未成功。
1) Approach 1 - Trying to just download a csv and store in local.
from("direct://start").
from("ftp://user@ftpserver/Directory?password=secret&download=true&fileName=a-b-c-2018-04-
16.csv")
.to("file://dir")
异常:没有类型转换器可用于转换类型: java.lang.Integer到所需类型:java.io.InputStream,值为-1
2) Approach 2 - Trying to unmarshal and save in a arrayBuffer
var result = mutable.ArrayBuffer.empty[String]
from("direct://start")
.from("ftp://user@ftpserver/Directory?password=secret&fileName=a-b-c-2018-
04-16.csv").unmarshal().csv().process(new Processor {
override def process(exchange: Exchange): Unit = {
val csvContent = exchange.getIn().getBody(classOf[String])
result+=csvContent
}
})
.to("file://dir")
我不认为它在这里运行处理器本身...... 给出与上述相同的错误。