简体   繁体   English

如何使用Mule ESB过滤出站路由?

[英]How to filter outbound routing using Mule ESB?

I have a instance of Mule that is configured to process xml responses from a third party provider. 我有一个Mule实例,该实例配置为处理来自第三方提供程序的xml响应。 Recently the provider has moved to a new revision and hence changed the xml response. 最近,提供者已移至新修订版,因此更改了xml响应。 Now I need a way to identify if the response is a v1 or v2 implementation and call the appropriate endpoint on my side to process the response. 现在,我需要一种方法来确定响应是v1还是v2实现,并在我这一边调用适当的端点来处理响应。

What I have currently is: 我目前所拥有的是:

<service name="processResponse">
...
    <outbound>
        <pass-through-router>
            <cxf:outbound-endpoint address="..." clientClass="..." wsdlPort="..." wsdlLocation="..." operation="..."/>
        </pass-through-router>
   </outbound>
</service>

I would prefer to add a filter in mule to identify the revision of the 3rd party (perhaps through the xml namespace in the response), and then call the appropriate class. 我希望在m子中添加一个过滤器以标识第三方的版本(也许通过响应中的xml名称空间),然后调用适当的类。 I cannot find any good examples of this. 我找不到任何好的例子。

Can someone provide an example of how this could be solved? 有人可以举例说明如何解决吗?

看一下这个示例 ,其中演示了一些版本转换。

I suspect the most straight forward means is a filtered route using an xpath filter. 我怀疑最直接的方法是使用xpath过滤器过滤路由。 First define vm services for each version. 首先为每个版本定义虚拟机服务。 Next you'll filter to them through a service with following outbound endpoint. 接下来,您将通过具有以下出站端点的服务来过滤它们。 A catch all is always a good idea. 一劳永逸总是一个好主意。

<outbound>
  <filtering-router>
    <vm:outbound-endpoint ref="Version1"/>
    <expression-filter evaluator="jxpath" expression="/your/version1/xpath/descriminator"/>
  </filtering-router>
  <filtering-router>
    <vm:outbound-endpoint ref="Version2"/>
    <expression-filter evaluator="jxpath" expression="/your/version2/xpath/descriminator"/>
  </filtering-router>
  <forwarding-catch-all-strategy>
    <stdio:outbound-endpoint system="ERR"/>
  </forwarding-catch-all-strategy>
</outbound>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM