我正在尝试编写一个简单的 Mule Flow 来监视文件目录,然后 SFTP 将它们发送到最终目的地。如果有大量文件,则 SFTP 应以 10 个为一组进行批量处理。
这是我的 XML
<flow name="FileTransferUtilFlow1" doc:name="FileTransferUtilFlow1">
<file:inbound-endpoint path="${source.dropbox.dir}"
moveToDirectory="${completed.dir}" responseTimeout="10000" doc:name="File">
<file:filename-wildcard-filter pattern="*.txt"
caseSensitive="true" />
</file:inbound-endpoint>
<async processingStrategy="Queued_Asynchronous_Processing_Strategy"
doc:name="Async">
<foreach doc:name="Foreach" batchSize="10">
<sftp:outbound-endpoint exchange-pattern="one-way"
host="192.168.1.14" port="22" path="${landing.dir}" user="myID"
password="xxyyzz" responseTimeout="10000" doc:name="SFTP"
outputPattern="#[header:originalFilename]" />
</foreach>
</async>
</flow>
这是错误:
java.lang.IllegalArgumentException: Object "org.mule.transport.file.ReceiverFileInputStream" not of correct type. It must be of type "interface java.lang.Iterable,interface java.util.Iterator,interface org.mule.routing.MessageSequence,interface java.util.Collection"
at org.mule.routing.CollectionSplitter.splitMessageIntoSequence(CollectionSplitter.java:60)
at org.mule.routing.Foreach$CollectionMapSplitter.splitMessageIntoSequence(Foreach.java:250)
at org.mule.routing.outbound.AbstractMessageSequenceSplitter.process(AbstractMessageSequenceSplitter.java:60)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)}