There are two clients named GC1 and GC2 which communicates with each other through ActiveMQ using Topic "GC1Alive" & "GC2Alive". They just send the heartbeat with each other by using these topics.
Purpose
The purpose of communication between two GC's is that when GC1 goes down then GC2 should replace GC1's position in case of Failover Scenario.
Failover scenario is automatically handled by ActiveMQ on its own end with the following URL as given below:
URL = "failover://(tcp://<AMQ Broker Url 1>:61616,tcp://<AMQ Broker Url 2>:61616)?timeout=30000";
Problem
When AMQ Broker 1 & GC1 goes down, then the communication starts on SideB, between the AMQ Broker 2 and GC2. Because when GC2 didn't receive any beat from GC1 after some time interval then GC2 takeover GC1 place and connect with AMQ Broker 2 which is UP right now.
But when AMQ Broker 1 & GC1 goes UP again , GC1 automatically sends beat to AMQ Broker 1 which already defines in URL failover scenario. So now GC1 send heartbeat to AMQ Broker 1 and GC2 send Heartbeat to AMQ Broker 2. So GC1 and GC2 are not redundant after the above use-case.
How can I make them redundant? Means when GC1 and AMQ Broker Up again then How GC1 check the heartbeat of GC2 that is it alive or dead?
Is there any other design available which helps in making cluster between GC1 and GC2?
Any help would be appreciated.