【发布时间】:2015-09-25 23:32:12
【问题描述】:
有没有办法从入站文件连接器获取文件,并在同一文件夹或不同位置生成同一文件的多个副本(例如 5 个)?我已经尝试使用 Scatter-Gather 组件,但结果并没有达到我的预期。请帮忙?
如果使用 Scatter-Gather 应该可以工作,我该如何编写 MEL 表达式来更改文件名,同时保留原始扩展名?我目前的mule流程如下。
<file:connector name="File_Send" readFromDirectory="C:\Users\AnypointStudio\workspace\MessageOut" autoDelete="true" streaming="true" validateConnections="true" doc:name="File"/>
<file:connector name="File_Receive" autoDelete="true" streaming="true" validateConnections="true" doc:name="File"/>
<spring:beans>
<spring:bean id="readFile" class="java.lang.String">
<spring:constructor-arg>
<spring:bean class="org.springframework.util.FileCopyUtils" factory-method="copyToByteArray">
<spring:constructor-arg type="java.io.InputStream" value="${C:\Users\AnypointStudio\workspace\MessageOut\24730717-99a3-4353-bfcc-d19d3ba7f50a.xml}"/>
</spring:bean>
</spring:constructor-arg>
</spring:bean>
</spring:beans>
<flow name="loop_testFlow">
<file:inbound-endpoint path="C:\Users\AnypointStudio\workspace" connector-ref="File_Send" responseTimeout="10000" doc:name="File"/>
<object-to-byte-array-transformer doc:name="Object to Byte Array"/>
<set-variable variableName="file" value="#[app.registry.readFile]" doc:name="Variable"/>
<scatter-gather doc:name="Scatter-Gather">
<file:outbound-endpoint path="C:\Users\AnypointStudio\workspace\MessageIn" connector-ref="File_Receive" responseTimeout="10000" doc:name="File"/>
<file:outbound-endpoint path="C:\Users\AnypointStudio\workspace\MessageIn" connector-ref="File_Receive" responseTimeout="10000" doc:name="File"/>
</scatter-gather>
</flow>
【问题讨论】:
标签: mule mule-studio mule-el