Mohamed Hosni
Mohamed Hosni

Reputation: 3

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

After spending a lot of time in configuring and trying a lot of solutions to make Artemis work in a cluster mode like the local mode in a publish-subscribe (topic). So, I 've prepared 3 consumers on different nodes and a producer that publish messages on only one node. I expect that the 3 consumers receives their own copy of messages like described in here!

The problem is the cluster (Core Bridge) still round robin messages between the 3 nodes.


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

Upvotes: 0

Views: 660

Answers (1)

Ashok Kallara
Ashok Kallara

Reputation: 16

In your ConnectionFactoryClusteredConfig.pubSubFactory() method, try moving factory.setPubSubDomain(true) after configurer.configure(factory, connectionFactory) as explained here: https://stackoverflow.com/a/44416121/832268.

Upvotes: 0

Related Questions