3 Replies Latest reply on Nov 12, 2013 12:54 PM by Justin Bertram

    How do I configure a remote JMS client to failover in a JBoss 7 scalable cluster

    Mark Evans Newbie

      I have two JBoss 7 instances clustered in a scalable configuration.  I have a client consuming messages.  If the server that the client is connected to goes down, I would like the client to failover to the second server.  I thought this could be accomplished by setting the provider URL to something like: "remote://host1:4447,remote://host2:4447" but if the first server is shut down, the client just fails to read messages.

       

      Is it possible to have a client read a JMS queue from a cluster and be able to restart individual nodes in the cluster?

       

      Does this require custom client code that connects to and reads from multiple nodes?

       

      Is there any documentation or examples on this?  (I've spent hours googling this and also reading through the hornetQ documentation -- which does not go into specifics about clients in a clustered JBoss environment.)

        • 1. Re: How do I configure a remote JMS client to failover in a JBoss 7 scalable cluster
          Justin Bertram Master

          If the server that the client is connected to goes down, I would like the client to failover to the second server.

          For that you'll need a live/backup pair.  See Chapter 39. High Availability and Failover.

           

          I thought this could be accomplished by setting the provider URL to something like: "remote://host1:4447,remote://host2:4447" but if the first server is shut down, the client just fails to read messages.

          The URL you cited here is a JNDI URL.  Keep in mind that JNDI and JMS are 100% independent of each other.  JNDI is only used to lookup the JMS admin objects (e.g. connection factory and destination).  Once the connection factory is looked up and the client receives the stub then a JMS connection is made (which is implemented by HornetQ using Netty).  The only time a JNDI URL with 2 hosts will help with fail-over is if the first server happens to fail before or during the JNDI lookup (which should really only be done once in an application's life-cycle).

           

          Is it possible to have a client read a JMS queue from a cluster and be able to restart individual nodes in the cluster?

          I'm not sure what you're asking here.  Can you clarify the specific use-case?

           

          Is there any documentation or examples on this?  (I've spent hours googling this and also reading through the hornetQ documentation -- which does not go into specifics about clients in a clustered JBoss environment.)

          There is no such thing as a general JBoss cluster - at least not in AS7 or Wildfly.  The individual components within the application server (e.g. HornetQ, Infinispan, etc.) can form a cluster and to that end the documentation for the individual projects should get you most of the way (if not all the way).  HornetQ clustering and HA functionality is essentially the same whether it is in the application server or out.

          • 2. Re: How do I configure a remote JMS client to failover in a JBoss 7 scalable cluster
            Mark Evans Newbie

            Justin Bertram wrote:

             

            Is it possible to have a client read a JMS queue from a cluster and be able to restart individual nodes in the cluster?

            I'm not sure what you're asking here.  Can you clarify the specific use-case?

             

            Thanks Justin.  Here's clarification:  Let's say I have 2 JBoss instances with their JMS HornetQ components clustered in s scalable fashion.  Is it possible to have a client use the queue on one of those servers, and if that server goes down, have the client automatically switch over to read the queue on the other server?

            • 3. Re: How do I configure a remote JMS client to failover in a JBoss 7 scalable cluster
              Justin Bertram Master

              Here's clarification:  Let's say I have 2 JBoss instances with their JMS HornetQ components clustered in s scalable fashion.  Is it possible to have a client use the queue on one of those servers, and if that server goes down, have the client automatically switch over to read the queue on the other server?

              In short, no.  Fail-over is only supported between a live and a backup (i.e. active and passive).  See the link in my previous comment for further discussion.

              1 of 1 people found this helpful