-
1. Re: HornetQ HA using Core API doesnt failover
clebert.suconic Oct 6, 2011 12:27 PM (in response to amit.gupta14)All the JMS Layer is doing is the same call you are making.
I would need to see some code to tell you exactly what are you doing differently.
-
2. Re: HornetQ HA using Core API doesnt failover
amit.gupta14 Oct 6, 2011 12:55 PM (in response to clebert.suconic)Map<String,Object> connectionParams1 = new HashMap<String,Object>();
connectionParams1.put(TransportConstants.HOST_PROP_NAME, 127.0.0.1);
connectionParams1.put(TransportConstants.PORT_PROP_NAME, 5445);
TransportConfiguration transportConfiguration1 = new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams1);Map<String,Object> connectionParams2 = new HashMap<String,Object>();
connectionParams2.put(TransportConstants.HOST_PROP_NAME, 127.0.0.1);
connectionParams2.put(TransportConstants.PORT_PROP_NAME, 5447);
TransportConfiguration transportConfiguration2 = new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams2);serverLocator = HornetQClient.createServerLocatorWithHA(transportConfiguration1, transportConfiguration2);
serverLocator.setRetryInterval(1000);
serverLocator.setRetryIntervalMultiplier(1.0);
serverLocator.setReconnectAttempts(1);
clientSessionFactory = serverLocator.createSessionFactory();
clientSession = clientSessionFactory.createSession(userName, password, false, true, true, true, 1);
clientSession.start();Unfortunately above code didn’t worked on Windows, but after putting below patch it worked on Windows for failover. But its not working on Linux, when both servers and client run on Linux.
Corresponding code works for JMS API both on windows and Linux.
for(int j=0;j<4;j++) {
if(clientSessionFactory != null)
clientSessionFactory.close();
clientSessionFactory = serverLocator.createSessionFactory();
} -
3. Re: HornetQ HA using Core API doesnt failover
amit.gupta14 Oct 6, 2011 1:26 PM (in response to amit.gupta14)Its working fine now. Fix is to remove second entry transportConfiguration2 which points to backup server. Very strange, I dont know why it works on Windows but not on AWS Linux node.
-
4. Re: HornetQ HA using Core API doesnt failover
amit.gupta14 Oct 6, 2011 1:45 PM (in response to amit.gupta14)Hi,
Conclusion:
Real culprit was serverLocator.setReconnectAttempts(1); I increased it to 10, transportConfiguration2 is fine.
Thnx
-
5. Re: HornetQ HA using Core API doesnt failover
clebert.suconic Oct 6, 2011 2:38 PM (in response to amit.gupta14)Most of the time I have seen it set to -1
But each use case is different, right? Just a thought!