【问题标题】:Mule SFTP Component componentMule SFTP 组件组件
【发布时间】:2018-11-21 07:34:59
【问题描述】:

我正在开发 mule 流程,其中 mule 进程必须将文件/文件(从源目录)上传到 SFTP 服务器。

IN 文件夹(此文件夹保存要传输到 SFTP 的文件)

我有下面的骡流

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:sftp="http://www.mulesoft.org/schema/mule/sftp" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
       xmlns:spring="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/sftp http://www.mulesoft.org/schema/mule/sftp/current/mule-sftp.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd">
    <flow name="sftpFlow1">
        <poll doc:name="Poll">
            <fixed-frequency-scheduler frequency="30" startDelay="10" timeUnit="SECONDS"/>
            <logger message="Hi" level="INFO" doc:name="Logger"/>
        </poll>
        <flow-ref name="sftpSub_Flow" doc:name="Flow Reference"/>
    </flow>
    <sub-flow name="sftpSub_Flow">
        <file:outbound-endpoint path="D:\IN" responseTimeout="10000" doc:name="File"/>
        <sftp:outbound-endpoint exchange-pattern="one-way" host="host" port="port" path="sftppath" user="user" password="password" responseTimeout="10000" doc:name="SFTP"/>
    </sub-flow>

</mule>

问题: 我没有看到任何错误或异常,但 IN 文件夹中的预期文件没有获得传输 SFTP 服务器。每次执行子流程时,我都会看到 ****.dat 文件。

有什么建议吗?

【问题讨论】:

    标签: mule-studio mule-component mule-esb


    【解决方案1】:

    在这里,您使用了两个出站端点。您需要文件入站端点组件才能从源位置选​​择文件。 请参阅下面的示例以获取更多信息 https://dzone.com/articles/anypoint-file-connector-with-mulesoft

    您可以使用 sftpoutbound 端点中的 outputPattern 属性来更改具有任何扩展名的文件名

    【讨论】:

    • 感谢您的回复,但是根据要求,SFTP 和 FILE 都应该是出站端点,因此我设计了这样的示例流程。
    • 应用程序应该有某种输入。您的样本丢失了,因此不现实。如果您希望得到答案,您应该提供更清晰的示例。
    【解决方案2】:

    因为应用程序实际上没有显示任何输入,所以我假设示例存在缺陷,但实际应用程序有一些以流模式读取的入站端点(例如文件入站端点)。子流试图消耗输入流的两倍以输出到两个出站端点。因为第一个消耗流,第二个 SFTP 获取一个消耗的空流作为输入,因此它不输出任何内容。一种解决方案是将输入转换为内存中的内容,例如在中间使用对象到字节数组转换器。请注意,对于大文件,执行此操作可能会耗尽内存。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多