[英]Can we move a file from an FTP server to a local directory using apache camel endpoints?
I was wondering if it is possible to move or download a file from FTP server to a local directory using the apache camel endpoints properties? 我想知道是否可以使用apache camel端点属性将文件从FTP服务器移动或下载到本地目录?
I already searched this topic and couldn't find anything that could help me. 我已经搜索了这个主题,找不到任何可以帮助我的东西。 Also, I'm not certain of its feasibility.
另外,我不确定它的可行性。
The endpoints URI= 端点URI =
sftp://user@ftp.com/outgoingFolder?password=*****&throwExceptionOnConnectFailed=true&maximumReconnectAttempts=0&stepwise=false&fastExistsCheck=true&disconnect=true&consumer.delay=300000&passiveMode=true
I used "&move=C:\\folder" as property but it didn't work and I get the following error 我使用“&move = C:\\ folder”作为属性,但是它不起作用,并且出现以下错误
WARN - [SftpConsumer:213] Consumer Consumer[sftp://user@ftp.com/outgoingFolder?consumer.delay=300000&disconnect=true&fastExistsCheck=true&maximumReconnectAttempts=0&move=C%3A%5C%5Cfolders&passiveMode=true&password=xxxxxx&stepwise=false&throwExceptionOnConnectFailed=true] failed polling endpoint: Endpoint[sftp://user@ftp.com/outgoingFolder?consumer.delay=300000&disconnect=true&fastExistsCheck=true&maximumReconnectAttempts=0&move=C%3A%5C%5Cfolder&passiveMode=true&password=xxxxxx&stepwise=false&throwExceptionOnConnectFailed=true]. Will try again at next poll. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot list directory:outgoingFolder]org.apache.camel.component.file.GenericFileOperationFailedException: Cannot list directory: outgoingFolder at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:617) at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:117) at org.apache.camel.component.file.remote.SftpConsumer.pollDirectory(SftpConsumer.java:79) at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:131) at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175) at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)Caused by: 4: at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2208) at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2215) at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1565) at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1526) at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:608) ... 12 more Caused by: java.io.IOException: inputstream is losed at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2884) at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2908) at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2189) ... 16 more
No, &move option is intended for moving file in scope of remote filesystem. 否,&move选项用于在远程文件系统范围内移动文件。
Use this instead: 使用此代替:
from("sftp://user@ftp.com/outgoingFolder?password=*****&throwExceptionOnConnectFailed=true&maximumReconnectAttempts=0&stepwise=false&fastExistsCheck=true&disconnect=true&consumer.delay=300000&passiveMode=true")
.to("file:C:\\folder");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.