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

发布于 2024-09-08 20:16:39 字数 566 浏览 7 评论 0原文

我有一个 Mule 实例,配置为处理来自第三方提供商的 xml 响应。最近,提供商已转向新版本,因此更改了 xml 响应。现在我需要一种方法来识别响应是 v1 还是 v2 实现,并调用我这边的适当端点来处理响应。

我目前所拥有的是:

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

我更愿意在 mule 中添加一个过滤器来识别第 3 方的修订(可能通过响应中的 xml 命名空间),然后调用适当的类。我找不到任何好的例子。

有人可以提供一个如何解决这个问题的例子吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一花一树开 2024-09-15 20:16:39

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

Take a look at this example, where some version transformation is demonstrated.

云雾 2024-09-15 20:16:39

我怀疑最直接的方法是使用 xpath 过滤器过滤路由。首先为每个版本定义vm服务。接下来,您将通过具有以下出站端点的服务来过滤它们。包罗万象总是一个好主意。

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

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文