问题描述
这是我的 mule-config
的相关部分, < ftp:connector name =ftp.connectorstreaming =true/>
< flow name =ftp2file>
< / flow>
当流式传输时, FTP 被禁用,但文件保持在我的情况下,当流媒体启用。
我有两个问题:
- 为什么行为在内部与流式传输与非流式传输不同
- 如何在我的情况下删除FTP服务器上的文件
正如您在,对Q1的回答是:由于传输仍在运行,因为传输处于流模式,Mule不会发出删除。
答案Q2是通过注册表获得一个FtpConnector,用 getFtp获得一个 FTPClient 实例(uri)使用您的FTP端点的URI,然后在 FTPClient 上调用 deleteFile 。
This is the relevant part of my mule-config
<ftp:connector name="ftp.connector" streaming="true"/> <flow name="ftp2file"> <ftp:inbound-endpoint connector-ref="ftp.connector" host="xxx" port="21" path="/path" user="test" password="test"/> <file:outbound-endpoint path="/newPath" outputPattern="#[header:originalFilename]"/> </flow>
Files on FTP server gets deleted when streaming is disabled but files stays on in my case when streaming is enabled.
I've 2 questions:
- Why is behavior internally different for streaming versus non streaming
- How can I delete files on FTP server in my case
As you've seen in https://stackoverflow.com/a/17974787/387927, the answer to Q1 is: because a transfer is still running, as the transport is in streaming mode, Mule will not issue a delete.
The answer Q2 would be to get a hold of the FtpConnector via the registry, get an FTPClient instance with getFtp(uri) using the URI of your FTP endpoint then call deleteFile on the FTPClient.
这篇关于为什么Mule FTP连接器在启用流式传输时不会删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!