我正在使用 Mule 3.2 并且我正在将文件从一个位置移动到另一个位置。错误/问题是 Mule 不断地一次又一次地处理相同的文件并且不删除它们。
控制台显示:
org.mule.transport.file.FileMessageReceiver: Lock obtained on file:
我的配置文件如下:
<flow name="File-FTP-Bridge">
<file:inbound-endpoint path="${outbound.input.path}"
moveToDirectory="${outbound.input.backup.path}">
<file:filename-wildcard-filter
pattern="*.msg" />
</file:inbound-endpoint>
<ftp:outbound-endpoint user="${outbound.ftp.user}"
password="${outbound.ftp.password}" host="${outbound.ftp.host}"
path="${outbound.ftp.path}" port="${outbound.ftp.port}"
outputPattern="#[header:originalFilename]">
</ftp:outbound-endpoint>
</flow>
我找不到这个问题的根本原因。提前致谢。
最佳答案
您的文件端点错过了 轮询频率属性,这意味着它使用默认值 1000 毫秒。这使得 Mule 轮询文件比 FTP 端点处理它们的速度更快。尝试例如:
pollingFrequency="10000"
如果这还不够好,因为 FTP 上传具有不可预测的性能(因此 Mule 仍会重试正在上传的文件),那么如果您的文件小到足以放入内存,请尝试添加:
<object-to-byte-array-transformer />
在您的入站和出站端点之间。这会在内存中加载文件,并在尝试 FTP 上传之前将其立即移动到 outbound.input.backup.path。当然,如果FTP上传失败,则必须将文件移回outbound.input.path...
关于file - Mule 文件传输不删除源文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8524357/