streamDownload
我有一个问题,FTP2 使用者(Camel 2.19.3)在启用该属性后处理文件后无法移动文件。当它设置为false
路由按预期工作但当属性是true
骆驼时无法移动文件。
路由配置(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
设置更改为 后,这是成功运行的 Wireshark 捕获false
:
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.
顺便说一句:stepwise=true
如果你想知道,改变没有任何区别。
我究竟做错了什么?这是一个错误还是我试图做一些骆驼不支持的事情?
问候, 马特