USE CASE:-- 1.we have one app which run in two server DP1 AND DP2 2.both dp1 and dp2 using embedded EmbeddedActiveMQ.java api to run apache activemq artemis. 3.if i start dp1 1st then it is become live server and dp2 become backup and vice versa 4.now i shutdown dp1 then dp2 become live and as i start dp1 it behave as backup till dp2 not fail. 5.in this case of artemis after fail of dp1, dp2 is not behaving as live server. because after failover of dp1 , dp2 is not get activate .i am checking like this and always traped into loop never come out from the loop.
while (!jmsServer.getActiveMQServer().waitForActivation(30L,TimeUnit.SECONDS)) { Thread.sleep(100);
}
6.API using for live and backup server
if (isCurrentServerLive){
ReplicatedPolicyConfiguration haPolicy = new ReplicatedPolicyConfiguration();
haPolicy.setGroupName("bsm-back-up-group");
haPolicy.setInitialReplicationSyncTimeout(120000);
haPolicy.setCheckForLiveServer(true); // Critical for failover detection
haPolicy.setQuorumSize(1); // Minimum nodes required
configuration.setHAPolicyConfiguration(haPolicy);
}else{
ReplicaPolicyConfiguration haPolicy = new ReplicaPolicyConfiguration();
haPolicy.setGroupName("bsm-back-up-group");
haPolicy.setInitialReplicationSyncTimeout(120000);
haPolicy.setRestartBackup(false); // Don't restart when live exists
haPolicy.setAllowFailBack(true); // Allow primary to resume
configuration.setHAPolicyConfiguration(haPolicy);;
}
i need your suggestion to make it work . and thanks in advance for your help.