3 Replies Latest reply on Sep 27, 2011 11:35 AM by subbu22

    Client Failover from statically defined cluster

    ajh Newbie

      I am experimenting with failover and have a live and backup server configured. I can successfully failover the server so that the backup server becomes the live server.


      What I am struggling with is how to failover the client. I want to be able to define the list of servers statically.


      On connection I have used the hornetq api:


                  HashMap<String, Object> map = new HashMap<String, Object>();

                  map.put("port", "5445");

                  TransportConfiguration server1 = new TransportConfiguration(NettyConnectorFactory.class.getName(), map);

                  HashMap<String, Object> map2 = new HashMap<String, Object>();

                  map2.put("port", "5446");

                  TransportConfiguration server2 = new TransportConfiguration(NettyConnectorFactory.class.getName(), map2);


                  HornetQConnectionFactory factory = HornetQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, server1, server2);




      How does the client know what backup servers are available to failover to. I have read that the above server list is for initial configuration only.

        • 1. Re: Client Failover from statically defined cluster
          Yong Hao Gao Master

          I think you need to have a look at the User Manual


          39.2.1. Automatic Client Failover


          It tells you the ways client can use to failover to a backup server.



          • 2. Re: Client Failover from statically defined cluster
            ajh Newbie

            For anyone that sees this post in the future I was actually missing the following line in the connection logic:




            Now clients failover correctly.

            • 3. Re: Client Failover from statically defined cluster
              subbu22 Newbie

              Hi ajh,


                I am looking for statically defined HA cluster environment.


              My requirement is:


              1. We were not allowed to use any shared file system. Since there is NO defined SAN

              2. UDP is not available  in the environment which means among the nodes in the cluster should have only static connectors.

              3. The client failover should happen in case of in case of connection lost to the live server. At this moment we are not bothered about the already sent messages whether they were processed or not? but the client should able to send the messages to the failover queue automatically.


              I tried with several examples, but unable to define the proper live-backup group with static connectors. Only live server is running but when back up server is not able to run.


              Could you please post your configuration. so that it would be a great help for me.


              Thanks in advance.