Why does Mule FTP connector doesn't delete file when streaming is enabled

霸气de小男生 提交于 2019-12-20 04:38:24

问题


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:

  1. Why is behavior internally different for streaming versus non streaming
  2. How can I delete files on FTP server in my case

回答1:


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.



来源:https://stackoverflow.com/questions/18366159/why-does-mule-ftp-connector-doesnt-delete-file-when-streaming-is-enabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!