【发布时间】:2015-07-29 15:45:11
【问题描述】:
目前情况:
骡子版本 3.5.0
我有一个 FTP 服务器,我可以使用 ftp:inbound-endpoint 使用特定路径连接到该服务器。 在该特定路径上,放置了很多文件(一些给我们,一些给其他人)所以我使用文件名通配符过滤器来过滤特定的文件名模式:
<flow name="flowA">
<ftp:inbound-endpoint host="${ftp.host}" port="${ftp.port}" user="${ftp.username}" password="${ftp.password}" path="${ftp.root.in}">
<file:filename-wildcard-filter pattern="${environment}*TYPE_A*.xml.gz" caseSensitive="false"/>
<gzip-uncompress-transformer/>
</ftp:inbound-endpoint>
<file:outbound-endpoint path="${home.dir}/typeA/in" responseTimeout="10000" outputPattern="#[message.inboundProperties.originalFilename]"/>
</flow>
这很好用,但现在我还想创建另一个流程,在同一 FTP 路径上查找具有不同名称的文件:
<flow name="flowB">
<ftp:inbound-endpoint host="${ftp.host}" port="${ftp.port}" user="${ftp.username}" password="${ftp.password}" path="${ftp.root.in}">
<file:filename-wildcard-filter pattern="${environment}*TYPE_B*.xml.gz" caseSensitive="false"/>
<gzip-uncompress-transformer/>
</ftp:inbound-endpoint>
<file:outbound-endpoint path="${home.dir}/typeB/in" responseTimeout="10000" outputPattern="#[message.inboundProperties.originalFilename]"/>
</flow>
这给了我以下异常:
Caused by: org.mule.api.transport.ConnectorException: There is already a listener registered on this connector on endpointUri: XXX
这意味着不可能有两个 ftp:inbound-endpoints 在同一主机上侦听但文件名不同的通配符过滤器...
我该如何解决这个问题?我是用一个 ftp:inbound-endpoint 指定一个流,然后根据文件名拆分传入的文件,还是有可能启用不同的 ftp:inbound-endpoints 在同一主机上侦听?
【问题讨论】:
-
我认为你不能同时拥有两个端点。您可以使用一个正则表达式过滤器来获取这两种文件,然后您可以使用选择元素再次路由(或者更好的是,设置一个“路径”变量以便稍后在出站中使用)。 HTH。
-
使用一个 ftp 入站端点(接收所有文件),然后使用基于通配符的过滤器并将其路由到 @afelisatti 建议的不同目的地
标签: ftp mule flow mule-component