简体   繁体   中英

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. Recently the provider has moved to a new revision and hence changed the xml response. 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.

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. 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. 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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