在 Apache Artemis ActiveMQ 中,是否可以将转移目标配置为另一个地址的源?
In Apache Artemis ActiveMQ, Would it be possible for to configure a diverts destination to be a source to another address?
该地址是否可以将已转移的邮件用作另一个地址的来源?如果可能的话,新的目标地址是否可以具有与源不同的路由类型,换句话说,我的新源地址是多播,新目标是任播,如果我理解正确,地址与根据我在此处阅读的内容,不可能有不同的路由类型。
Diverts can apply a particular routing-type to the message, strip the existing routing type, or simply pass the existing routing-type through. This is useful in situations where the message may have its routing-type set but you want to divert it to an address using a different routing-type. It's important to keep in mind that a message with the anycast routing-type will not actually be routed to queues using multicast and vice-versa
我尝试配置的设置如下所示
<addresses>
<address name="source.A">
<multicast>
<queue name="source.A"/>
</multicast>
</address>
<address name="source.B">
<multicast>
<queue name="source.B"/>
</multicast>
</address>
<address name="destination.AB">
<multicast>
<queue name="destination.AB"/>
</multicast>
</address>
<address name="destination.C">
<anycast>
<queue name="destination.C"/>
</anycast>
</address>
</addresses>
<diverts>
<divert name="divert-A">
<routing-name>divert-A</routing-name>
<address>source.A</address>
<forwarding-address>destination.AB</forwarding-address>
<exclusive>true</exclusive>
</divert>
<divert name="divert-B">
<routing-name>divert-B</routing-name>
<address>source-B</address>
<forwarding-address>destination.AB</forwarding-address>
<exclusive>true</exclusive>
</divert>
<divert name="divert-AB">
<routing-name>divert-AB</routing-name>
<address>destination.AB</address>
<forwarding-address>destination.C</forwarding-address>
<exclusive>false</exclusive>
</divert>
</diverts>
链 将一个的 forwarding-address
用于另一个的 address
(即“源”)一起转移应该没有问题。
关于路由类型的问题,我认为您误解了转移文档。声明说,“重要的是要记住,具有任播路由类型的消息实际上不会使用多播路由到队列,反之亦然,”只是描述了转移暴露 routing-type
配置元素。不同路由类型的地址之间的转移当然是可能的。正如您引用的文档所解释的那样,使用 routing-type
配置元素转移可以执行以下操作之一:
- 对邮件应用特定的路由类型
- 去除现有路由类型
- 通过
传递现有路由类型
routing-type
的有效值为 ANYCAST
、MULTICAST
、STRIP
和 PASS
。默认值为 STRIP
。正如文档所述,routing-type
“在消息可能设置了路由类型但您想将其转移到使用不同路由类型的地址的情况下很有用。”
由于默认转移 routing-type
是 STRIP
任何流经转移的消息都将删除其路由类型,这意味着它将被路由到 all 绑定到已配置 forwarding-address
的队列,无论它们是 anycast
还是 multicast
队列。
该地址是否可以将已转移的邮件用作另一个地址的来源?如果可能的话,新的目标地址是否可以具有与源不同的路由类型,换句话说,我的新源地址是多播,新目标是任播,如果我理解正确,地址与根据我在此处阅读的内容,不可能有不同的路由类型。
Diverts can apply a particular routing-type to the message, strip the existing routing type, or simply pass the existing routing-type through. This is useful in situations where the message may have its routing-type set but you want to divert it to an address using a different routing-type. It's important to keep in mind that a message with the anycast routing-type will not actually be routed to queues using multicast and vice-versa
我尝试配置的设置如下所示
<addresses>
<address name="source.A">
<multicast>
<queue name="source.A"/>
</multicast>
</address>
<address name="source.B">
<multicast>
<queue name="source.B"/>
</multicast>
</address>
<address name="destination.AB">
<multicast>
<queue name="destination.AB"/>
</multicast>
</address>
<address name="destination.C">
<anycast>
<queue name="destination.C"/>
</anycast>
</address>
</addresses>
<diverts>
<divert name="divert-A">
<routing-name>divert-A</routing-name>
<address>source.A</address>
<forwarding-address>destination.AB</forwarding-address>
<exclusive>true</exclusive>
</divert>
<divert name="divert-B">
<routing-name>divert-B</routing-name>
<address>source-B</address>
<forwarding-address>destination.AB</forwarding-address>
<exclusive>true</exclusive>
</divert>
<divert name="divert-AB">
<routing-name>divert-AB</routing-name>
<address>destination.AB</address>
<forwarding-address>destination.C</forwarding-address>
<exclusive>false</exclusive>
</divert>
</diverts>
链 将一个的 forwarding-address
用于另一个的 address
(即“源”)一起转移应该没有问题。
关于路由类型的问题,我认为您误解了转移文档。声明说,“重要的是要记住,具有任播路由类型的消息实际上不会使用多播路由到队列,反之亦然,”只是描述了转移暴露 routing-type
配置元素。不同路由类型的地址之间的转移当然是可能的。正如您引用的文档所解释的那样,使用 routing-type
配置元素转移可以执行以下操作之一:
- 对邮件应用特定的路由类型
- 去除现有路由类型
- 通过 传递现有路由类型
routing-type
的有效值为 ANYCAST
、MULTICAST
、STRIP
和 PASS
。默认值为 STRIP
。正如文档所述,routing-type
“在消息可能设置了路由类型但您想将其转移到使用不同路由类型的地址的情况下很有用。”
由于默认转移 routing-type
是 STRIP
任何流经转移的消息都将删除其路由类型,这意味着它将被路由到 all 绑定到已配置 forwarding-address
的队列,无论它们是 anycast
还是 multicast
队列。