Search code examples
activemq-classicfailover

activemq failover : primary node recover consumers?


I am new to activemq. I have configured two servers of activemq and using them in failover transport. They are working fine. I mean if one activemq goes down another pick up the queues. My problem is when main server comes up it do not restore the queues. Is there any such configuration or protocol that can manage it if main server is up then consumers should come back to to it.

Currently my configuration is :

    <transportConnectors>
                    <transportConnector name="openwire" uri="tcp://0.0.0.0:61616" updateClusterClients="true" rebalanceClusterClients="true"/>
    </transportConnectors>
<networkConnectors>
                <networkConnector uri="static:(tcp://192.168.0.122:61616)"
                networkTTL="3"
                prefetchSize="1"
                decreaseNetworkConsumerPriority="true" />
</networkConnectors>

and my connection uri is :

failover:(tcp://${ipaddress.master}:61616,tcp://${ipaddress.backup}:61616)?randomize=false

Also i want to send mail in case of failover occurs so that i could know if activemq is down.


Solution

  • I have done that. And posting solution in case any one is having same problem. This feature is available in activemq 5.6. priorityBackup=true in connection url is the key to tell to tell consumer to come back on primary node if available.

    My new connection uri is :

    failover:master:61616,tcp://backup:61616)?randomize=false&amp;priorityBackup=true
    

    see here for more details.