mule 4 sftp文件读取后删除文件,读取文件

发布于 2025-01-28 18:30:11 字数 1781 浏览 4 评论 0原文

使用Mule 4.4社区版。 我正在使用Mule的SFTP连接器读取文件:

    <dependency>
        <groupId>org.mule.connectors</groupId>
        <artifactId>mule-sftp-connector</artifactId>
        <version>1.4.1</version>
        <classifier>mule-plugin</classifier>
    </dependency>

在Dedug模式下运行代码,在读取文件后,我仍然可以在SFTP位置(很好)上查看该文件,但是在文件读取后它消失了。...(请参阅下文代码)

<sftp:config name="SFTP_Config" doc:name="SFTP Config"
    timeBetweenSizeCheck="30" timeBetweenSizeCheckUnit="SECONDS">
    <sftp:connection host="myHost" port="22" username="myUser" password="myPassword" />
</sftp:config>

<until-successful maxRetries="1" doc:name="Until Successful"  millisBetweenRetries="30000">
            <sftp:read doc:name="Read employee file"  config-ref="SFTP_Config" path="${sftp.inputDir}\employee.unl" timeBetweenSizeCheck="-1" outputMimeType="application/csv; streaming=true; header=false; separator=|" outputEncoding="UTF-8">
                <non-repeatable-stream />
        </sftp:read>
        </until-successful>
        
        <choice doc:name="is the file empty ?"  >
            <when expression="sizeOf(payload) == 0">
                <raise-error doc:name="Raise error on empty file "  type="FILE_NOT_PRESENT_OR_EMPTY" description="Employee File empty "/>
            </when>
            <otherwise >
                <logger level="INFO" doc:name="Payload not empty"  message=" #[sizeOf(payload)]" category="employee"/>
            </otherwise>
        </choice>

因此,当代码输入选择条件时,我可以看到该文件在SFTP驱动器上不再可用...

我已经在调试模式下测试了此代码,以验证文件何时删除 /消失。

不知道为什么会发生这种情况?

为什么在代码进入选择条件后,文件被删除?

Using Mule 4.4 community edition .
I am reading a file using mule's sftp connector :

    <dependency>
        <groupId>org.mule.connectors</groupId>
        <artifactId>mule-sftp-connector</artifactId>
        <version>1.4.1</version>
        <classifier>mule-plugin</classifier>
    </dependency>

Running code in dedug mode , after the file is read , I can still see the file on sftp location ( which is good ) , however it disappears after file read .... ( see below code )

<sftp:config name="SFTP_Config" doc:name="SFTP Config"
    timeBetweenSizeCheck="30" timeBetweenSizeCheckUnit="SECONDS">
    <sftp:connection host="myHost" port="22" username="myUser" password="myPassword" />
</sftp:config>

<until-successful maxRetries="1" doc:name="Until Successful"  millisBetweenRetries="30000">
            <sftp:read doc:name="Read employee file"  config-ref="SFTP_Config" path="${sftp.inputDir}\employee.unl" timeBetweenSizeCheck="-1" outputMimeType="application/csv; streaming=true; header=false; separator=|" outputEncoding="UTF-8">
                <non-repeatable-stream />
        </sftp:read>
        </until-successful>
        
        <choice doc:name="is the file empty ?"  >
            <when expression="sizeOf(payload) == 0">
                <raise-error doc:name="Raise error on empty file "  type="FILE_NOT_PRESENT_OR_EMPTY" description="Employee File empty "/>
            </when>
            <otherwise >
                <logger level="INFO" doc:name="Payload not empty"  message=" #[sizeOf(payload)]" category="employee"/>
            </otherwise>
        </choice>

So when the code enters the choice condition I can see the file is somehow no longer available on SFTP drive ...

I have tested this code in debug mode to verify when the file is getting deleted / disappearing.

Not sure why this would happen ?

why is the file getting deleted after code enters into the choice condition ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文