Question

Here is what I try to achieve with ActiveMQ: I'd like to have 2 clusters of brokers: clusterA and clusterB. Data between these 2 clusters should be mirrored. So, when clusterA receives a message it will be stored at storageA and also this message should be forwarded to clusterB (if there is such demand) and stored in storageB. On the other hand if clusterB receives a message it should be forwarded to clusterA. I'm wondering whether config like this considered to be valid according to described above:

    <networkConnectors>
    <networkConnector 
          uri="static:(failover(tcp://clusterB_broker1:port,tcp://clusterB_broker2:port,tcp://clusterB_broker3:port))"
          name="bridge"
          duplex="true"
          conduitSubscriptions="true"
          decreaseNetworkConsumerPriority="false"/> 
    </networkConnectors>
Was it helpful?

Solution

This is a valid configuration. It indicates (assuming that all ClusterA brokers are configured this way) that brokers in ClusterA will store and forward first to clusterB_broker1, and if it is down will instead store and forward to clusterB_broker2, and then to clusterB_broker3 if clusterB_broker2 is down. But depending on your intra-cluster broker configuration, it is not going to do what you want it to.

The broker configurations must be set up for failover themselves or else you will lose messages when clusterB_broker1 goes down. If clusterB brokers are not working together as described below, then when clusterB_broker1 goes down, any messages sent to it will not be present or accessible on the other clusterB brokers. New messages will forward to them.

How to do failover within the cluster depends on your ActiveMQ version.

The latest version (5.9.0) supports 3 failover (or master/slave) cluster configurations. For quick reference, they are:

  • Shared File System Master Slave
  • JDBC Master Slave
  • Replicated LevelDB Store

Earlier versions supported a master/slave configuration that had one master and one slave node where messages were forwarded to the slave broker. This setup was not well maintained, had bugs, and has been removed from ActiveMQ.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top