【问题标题】:Prevent file transport from closing stream in Mule防止文件传输关闭 Mule 中的流
【发布时间】:2013-11-16 07:09:08
【问题描述】:

我正在尝试将csv 文件复制到本地目录,然后解析SftpInputStream。文件被正确复制。但是,虽然我在文件连接器中将streaming 设置为false,但似乎file inbound-endpoint 关闭了流,因此我的转换器无法解析流。

如何防止file:outbound-endpoint 在复制文件后关闭stream

这些是我的连接器:

<sftp:connector name="mySftpConnector" pollingFrequency="1000" autoDelete="true" />
    <file:connector name="myFileOutputConnector" streaming="false" outputPattern="#[header:originalFilename]" />

这是我的流程:

<flow name="myFlow" processingStrategy="synchronous">

    <sftp:inbound-endpoint
            address="xxx"
            connector-ref="mySftpConnector" autoDelete="false">
            <file:filename-wildcard-filter pattern="*.csv"/>
    </sftp:inbound-endpoint>

    <file:outbound-endpoint path="/archive" connector-ref="myFileOutputConnector" />

    <transformer ref="mySftpTransformer" />

    <component>
         <spring-object bean="mySftpHandler" />
    </component>

</flow>

抛出的异常是:

java.io.IOException: Stream closed
        at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:308)
        at org.mule.transport.sftp.SftpInputStream.read(SftpInputStream.java:90)
        ...

【问题讨论】:

    标签: java file stream mule transport


    【解决方案1】:

    如果FTP 连接器上的streaming 未启用,Mule 将尝试将它从 FTP 服务器获取的文件读取到一个字节[] 中,以用作 MuleMessage 的有效负载。之后流被关闭。

    如果在inbound endpoints 上使用streaming,则用户有责任关闭输入流。你可以打开stream试试

    【讨论】:

      猜你喜欢
      • 2016-02-12
      • 2021-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-18
      • 2011-07-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多