Mule:多播路由器和静态接收者列表路由器有什么区别?
我真的看不出多播路由器和静态收件人列表路由器之间的区别。我为什么要使用其中一种而不是另一种?
收件人列表
可以使用收件人列表路由器 将同一事件发送给多个 同一端点上的端点或 实现路由滑动行为,其中 活动的下一个目的地是 根据事件属性确定 或有效负载。 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
直接来自马的嘴(Mule in Action,作者:David Dossot,John D'Emic,第 17 页) 98..100)
Straight from the horse's mouth (Mule in Action, by David Dossot, John D'Emic, p. 98..100)
这就是我的理解:
静态收件人列表路由器将按照列出的顺序将有效负载发送给每个收件人。这使您能够在继续到下一个端点之前修改有效负载。这还使您能够在发生错误时停止处理。
多播路由器同时向所有端点发送相同的有效负载。您将无法更改每个端点的有效负载。如果其中一个端点发生故障,您将无法停止其他端点的处理。
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.