Active MQ - Brokers Network

I set up a network of brokers with a topology as shown below.

  • Manufacturer (P1) connected to Broker (B1) and Producer (P2) connected to Broker (B2)
  • Broker (B1) and Broker (B2) are connected as a network of brokerage companies and are balanced by balance.
  • Consumer (C1) connected to the Broker (B1) and Consumer (C2) connected to the Broker (B2)

Clients are configured to use fault tolerance as:

  • Consumer-1 = switching to another resource: tcp: // localhost: 61616, tcp: // localhost: 61615? randomize = false
  • Consumer-2 = failover: tcp: // localhost: 61615, tcp: // localhost: 61616? randomize = false

As soon as channel-2 goes down, P2 and C2 will move to channel-1, which is the desired failure behavior.

I want to understand the behavior when the Chaneel-2 returns? I noticed that only Channel-1 continues to service all connections even after channel-2 has recovered and, thus, has lost load balancing between the channels.

I want to know if it is possible, as soon as Channel-2 returns, load balancing will start automatically between the channels, and the corresponding Producer-2, Consumers-2 will shift to Channel-2 and, thus, will ensure full load balancing and a complete transition to another resource ?

I came across the article “Combining Failover with Load Balancing” at http://fusesource.com/docs/broker/5.4/clustering/index.html is recommended for combining failover and load balancing?

Hello,

-Amber

+4
source share
2 answers

In both of your brokers, you need to configure your transport connector to enable updateClusterClients and rebalanceClusterClients.

<transportConnectors> <transportConnector name="tcp-connector" uri="tcp://192.168.0.23:61616" updateClusterClients="true" rebalanceClusterClients="true" /> </<transportConnectors> 

In particular, you should want rebalanceClusterClients. The docs http://activemq.apache.org/failover-transport-reference.html states that:

if true, connected clients will be asked to rebalance the brokers cluster when a new broker joins the brokers network

You must use ActiveMQ 5.4 or higher to have these options.

+4
source

As an answer to your next question: "Is there a way to register a broker URI, as described in the article?"

To show which client is associated with which broker, change the configuration of the Log4j client as follows:

 <log4j:configuration debug="true" xmlns:log4j="http://jakarta.apache.org/log4j/"> ... <logger name="org.apache.activemq.transport.failover.FailoverTransport"> <level value="debug"/> </logger> ... </log4j:configuration> 
0
source

All Articles