activemq artemis spring boot 集群主题负载均衡(round robin)问题

active-mq artemis springboot clustered topic load balancing (round robin) issue

在花费大量时间配置和尝试大量解决方案后,使 Artemis 在 集群 模式下工作,如 local 发布-订阅(主题)模式。 所以,我在不同的 nodes 上准备了 3 个 consumers 和一个只在一个节点上发布消息的 producer节点。 我希望这 3 个消费者收到他们自己的消息副本,如 here 中所述!

问题是集群(Core Bridge)仍然在 3 个节点之间循环消息。


My project Github Repo

spring-boot-artemis-clustered-topic


Broker Cluster Config

<!-- Using STRICT is like setting the legacy forward-when-no-consumers 
parameter to true--> 
<!-- Using ON_DEMAND is like setting the legacy forward-when-no-consumers 
parameter to false.-->
<cluster-connections>
     <cluster-connection name="my-cluster">
     <address>jms</address>
        <connector-ref>netty-connector</connector-ref>
        <retry-interval>500</retry-interval>
        <use-duplicate-detection>true</use-duplicate-detection>
        <message-load-balancing>ON_DEMAND</message-load-balancing>
        <max-hops>1</max-hops>
        <discovery-group-ref discovery-group-name="my-discovery-group"/>
     </cluster-connection>

</cluster-connections>

Consumers behavior artemis-b1-b2-b3

在您的 ConnectionFactoryClusteredConfig.pubSubFactory() 方法中,尝试将 factory.setPubSubDomain(true) 移动到 configurer.configure(factory, connectionFactory) 之后,如下所述: