Mule:多播路由器和静态接收者列表路由器有什么区别?

发布于 2024-09-16 00:42:04 字数 1559 浏览 7 评论 0原文

我真的看不出多播路由器和静态收件人列表路由器之间的区别。我为什么要使用其中一种而不是另一种?

根据 Mule-2 .x 用户指南

收件人列表

可以使用收件人列表路由器 将同一事件发送给多个 同一端点上的端点或 实现路由滑动行为,其中 活动的下一个目的地是 根据事件属性确定 或有效负载。 Mule 提供了一个摘要 收件人名单实施 org.mule.routing.outbound.AbstractRecipientList 它提供了一个线程安全的基础 专门的实施。骡子也 提供静态收件人列表 获取已配置的端点列表 从当前事件或静态 在端点上声明。

 <outbound>
     <static-recipient-list-router>
        <payload-type-filter expectedType="javax.jms.Message"/>
        <recipients>
                <spring:value="jms://orders.queue"/>
                <spring:value="jms://tracking.queue"/>
        </recipients>
     </static-recipient-list-router> </outbound>

组播路由器

多播路由器可用于 通过多个发送相同的事件 端点。使用本路由器时的注意事项 必须采取正确的配置 端点上的变压器 处理事件源类型。

 <outbound>
     <multicasting-router>
        <jms:endpoint queue="test.queue"
 transformer-refs="StringToJmsMessage"/>
        <http:endpoint host="10.192.111.11"
 transformer-refs="StringToHttpClientRequest"/>
        <tcp:endpoint host="10.192.111.12"
 transformer-refs="StringToByteArray"/>
        <payload-type-filter expectedType="java.lang.String"/>
     </multicasting-router> </outbound>

请记住,应注意 确保消息被路由 被转换为这样的格式 端点理解。

I can't really see a difference between a multicasting-router and a static-recipient-list-router. Why would I use one over the other?

According to Mule-2.x user guide

Recipient List

the Recipient list router can be used
to send the same event to multiple
endpoints over the same endpoint or to
implement routing-slip behaviour where
the next destination for the event is
determined from the event properties
or payload. Mule provides an abstract
Recipient list implementation
org.mule.routing.outbound.AbstractRecipientList
that provides a thread-safe base for
specialised implementations. Mule also
provides a Static recipient list that
takes a configured list of endpoints
from the current event or statically
declared on the endpoint.

 <outbound>
     <static-recipient-list-router>
        <payload-type-filter expectedType="javax.jms.Message"/>
        <recipients>
                <spring:value="jms://orders.queue"/>
                <spring:value="jms://tracking.queue"/>
        </recipients>
     </static-recipient-list-router> </outbound>

Multicasting Router

The Multicasting router can be used to
send the same event over multiple
endpoints. When using this router care
must be taken to configure the correct
transformers on the endpoints to
handle the event source type.

 <outbound>
     <multicasting-router>
        <jms:endpoint queue="test.queue"
 transformer-refs="StringToJmsMessage"/>
        <http:endpoint host="10.192.111.11"
 transformer-refs="StringToHttpClientRequest"/>
        <tcp:endpoint host="10.192.111.12"
 transformer-refs="StringToByteArray"/>
        <payload-type-filter expectedType="java.lang.String"/>
     </multicasting-router> </outbound>

Remember that care should be taken to
ensure that the message being routed
is transformed to a format that the
endpoint understands.

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

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

发布评论

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

评论(2

迷爱 2024-09-23 00:42:04

直接来自马的嘴(Mule in Action,作者:David Dossot,John D'Emic,第 17 页) 98..100)

静态收件人列表路由器允许您同时向多个端点发送相同的消息。当每个端点使用相同的传输时,您通常会使用静态收件人列表。 VM 和 JMS 端点经常出现这种情况。

使用相同的传输将相同的消息发送到端点时使用静态收件人列表

多播路由器与静态收件人列表类似,它同时通过一组出站端点发送相同的消息。不同之处在于,当端点列表包含不同类型的传输时,将使用多播路由器。

将相同的消息发送到使用不同传输的端点时使用多播路由器

Straight from the horse's mouth (Mule in Action, by David Dossot, John D'Emic, p. 98..100)

The static-recipient-list router lets you simultaneously send the same message to multiple endpoints. You'll usually use a static recipient list when each endpoint is using the same transport. This is often the case with VM and JMS endpoints.

Use static recipient lists when sending the same message to endpoints using identical transports

The multicasting router is similar to the static recipient list in that it simultaneously sends the same message across a set of outbound endpoints. The difference is that the multicasting router is used when the endpoint list contains different types of transports.

Use the multicasting router when sending the same message to endpoints using different transports

黎夕旧梦 2024-09-23 00:42:04

这就是我的理解:

静态收件人列表路由器将按照列出的顺序将有效负载发送给每个收件人。这使您能够在继续到下一个端点之前修改有效负载。这还使您能够在发生错误时停止处理。

多播路由器同时向所有端点发送相同的有效负载。您将无法更改每个端点的有效负载。如果其中一个端点发生故障,您将无法停止其他端点的处理。

This is how I understand these:

The static-recipient-list router will send the payload to each recipient in the order that they are listed. This gives you the ability to modify the payload before proceeding to the next endpoint. This also gives you the ability to stop processing in the event of an error.

The multicast-router sends the same payload to all endpoints at the same time. You will not be able to change the payload for each endpoint. You will not be able to stop other endpoints from processing if one of the endpoints fail.

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