如何在使用流媒体时关闭Mule中的FTP入站端点的输入流 [英] How to close input stream of FTP inbound endpoint in Mule when streaming is used

查看:131
本文介绍了如何在使用流媒体时关闭Mule中的FTP入站端点的输入流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的配置,从FTP服务器将文件复制到文件出站。我正在使用 streaming 进行文件传输,因为文件很大。这是我的配置:

$ p $ < ftp:connector name =ftpConnectorstreaming =truepollingFrequency =360000/ >

< flow name =copyFTPtoFile>
< file:outbound-endpoint path =/ vendor / in/>
< / flow>

我不知道如何关闭 input-stream ,这样一旦复制,文件就从FTP服务器上被删除。

解决方案

c> InputStream ,以下代码 file outbound endpoint dispatcher 将被执行:

  InputStream is = event.transformMessage(DataTypeFactory.create(InputStream.class)); 
IOUtils.copyLarge(is,fos);
is.close();

所以流应该会自动关闭。


I have a very simple configuration which copies the file from FTP server to file outbound. I am using streaming for file transfer because of huge file sizes. This is my config:

 <ftp:connector name="ftpConnector" streaming="true" pollingFrequency="360000"/>

    <flow name="copyFTPtoFile">
        <ftp:inbound-endpoint name="FTP" connector-ref="ftpConnector" host="FTP" port="21" user="test" password="test" path="/Testenv" />
        <file:outbound-endpoint path="/vendor/in" />
    </flow>

I am not sure how to close the input-stream so that files are deleted from FTP server once they are copied.

解决方案

Since the payload is an InputStream, the following code of the file outbound endpoint dispatcher will be executed:

InputStream is = event.transformMessage(DataTypeFactory.create(InputStream.class));
IOUtils.copyLarge(is, fos);
is.close();

So the stream should be automatically closed for you.

这篇关于如何在使用流媒体时关闭Mule中的FTP入站端点的输入流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆