Abhishek bhutra
Abhishek bhutra

Reputation: 1422

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.

Upvotes: 0

Views: 2613

Answers (2)

Abhishek bhutra
Abhishek bhutra

Reputation: 1422

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.

Upvotes: 1

Jakub Korab
Jakub Korab

Reputation: 5034

What you have configured there is not a true HA deployment, but a network of brokers. If you have two brokers configured in a network, each has its own message store, which at any time contains a partial set of messages (see how networks of brokers work).

The behaviour that you would likely expect to see is that if one broker falls over, the other takes its place resuming from where the failed one left off (with all of the undelivered messages that the failed broker held). For that you need to use a (preferably shared-storage) master-slave configuration.

Upvotes: 2

Related Questions