我遇到问题,FTP2使用者(Camel 2.19.3)在启用streamDownload
属性后处理文件后无法移动文件。当它设置为false
时,路由按预期工作,但当属性为true
时,Camel无法移动文件。
路由配置(Java DSL)如下所示:
from("ftp://{{ftp.username}}@{{ftp.host}}/{{ftp.path.in}}"
+ "?password={{ftp.password}}"
+ "&initialDelay={{ftp.check.startdelay}}"
+ "&delay={{ftp.check.delay}}"
+ "&passiveMode=true"
+ "&autoCreate=false"
+ "&startingDirectoryMustExist=true"
+ "&move={{ftp.path.out}}/${file:name}"
+ "&stepwise=false"
+ "&streamDownload=true"
)
.to("log:com.example.camel?level=info")
.to("mock:aMockEndpoint");
以下是我收到的错误消息示例:
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot rename file: RemoteFile[abc123a.csv] to: RemoteFile[/reports/archive/abc123a.csv]
这是一个Wireshark捕获,显示streamDownload
设置为true
时失败的运行的交互:
Response: 220 (xxx)
Request: USER xxx
Response: 331 Please specify the password.
Request: PASS xxx
Response: 230 Login successful.
Request: TYPE A
Response: 200 Switching to ASCII mode.
Request: SYST
Response: 215 UNIX Type: L8
Request: PASV
Response: 227 Entering Passive Mode (192,168,1,10,108,120).
Request: LIST reports/incoming
Response: 150 Here comes the directory listing.
FTP Data: 69 bytes
Response: 226 Directory send OK.
Request: PASV
Response: 227 Entering Passive Mode (192,168,1,10,234,184).
Request: RETR reports/incoming/abc123a.csv
Response: 150 Opening BINARY mode data connection for reports/incoming/abc123a.csv (21 bytes).
FTP Data: 21 bytes
Request: DELE /reports/archive/abc123a.csv
Response: 226 Transfer complete.
Response: 550 Delete operation failed.
Request: PWD
Response: 257 "/" is the current directory
Request: CWD /reports/archive
Response: 250 Directory successfully changed.
Request: RNFR reports/incoming/abc123a.csv
Response: 550 RNFR command failed.
Request: QUIT
Response: 221 Goodbye.
似乎Camel正在尝试删除并重命名该文件,因为它仍被FTP服务器锁定(即被路由占用)。
现在,在将streamDownload
设置更改为false
后,这是一个成功运行的Wireshark捕获:
Response: 220 (xxx)
Request: USER xxx
Response: 331 Please specify the password.
Request: PASS xxx
Response: 230 Login successful.
Request: TYPE A
Response: 200 Switching to ASCII mode.
Request: SYST
Response: 215 UNIX Type: L8
Request: PASV
Response: 227 Entering Passive Mode (192,168,1,10,253,94).
Request: LIST reports/incoming
Response: 150 Here comes the directory listing.
FTP Data: 69 bytes
Response: 226 Directory send OK.
Request: PASV
Response: 227 Entering Passive Mode (192,168,1,10,125,167).
Request: RETR reports/incoming/abc123a.csv
Response: 150 Opening BINARY mode data connection for reports/incoming/abc123a.csv (21 bytes).
FTP Data: 21 bytes
Response: 226 Transfer complete.
Request: DELE /reports/archive/abc123a.csv
Response: 550 Delete operation failed.
Request: PWD
Response: 257 "/" is the current directory
Request: CWD /reports/archive
Response: 250 Directory successfully changed.
Request: CWD /
Response: 250 Directory successfully changed.
Request: RNFR reports/incoming/abc123a.csv
Response: 350 Ready for RNTO.
Request: RNTO /reports/archive/abc123a.csv
Response: 250 Rename successful.
Request: NOOP
Response: 200 NOOP ok.
Request: PASV
Response: 227 Entering Passive Mode (192,168,1,10,168,183).
Request: LIST reports/incoming
Response: 150 Here comes the directory listing.
Response: 226 Directory send OK.
Request: QUIT
Response: 221 Goodbye.
BTW:如果你想知道改变stepwise=true
没有任何区别。
我做错了什么?这是一个错误还是我试图做一些Camel不支持的事情?
此致 马特