我正在开发mule流程,其中mule进程必须上传文件/文件(从源目录)到SFTP服务器。
在文件夹中(此文件夹保存要传输到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文件。
有什么建议吗?
发布于 2018-08-01 14:02:08
在这里,您已经使用了两个出站端点。您需要文件入站终结点组件从源位置选取文件。有关进一步的https://dzone.com/articles/anypoint-file-connector-with-mulesoft,请参阅下面的示例
您可以使用sftpoutbound终结点中的outputPattern属性来更改带有任何扩展名的文件名
发布于 2018-11-21 07:34:59
因为应用程序实际上没有显示任何输入,所以我假设示例是有缺陷的,但实际的应用程序有一些以流模式读取的入站端点(例如文件入站端点)。子流试图消耗两次输入流来输出到两个出站端点。因为第一个函数使用流,所以第二个函数SFTP获得一个使用的空流作为输入,所以它不会输出任何内容。一种解决方案是将输入转换为内存中的内容,例如在中间使用对象到字节数组的转换器。需要注意的是,对于大文件,这样做可能会耗尽内存。
https://stackoverflow.com/questions/51617232
复制相似问题