1 Reply Latest reply on Oct 25, 2012 12:13 AM by raysen_jia

    Static Cluster Discovery, How to configure Comsumer Cluster

    raysen_jia

      Dear Team,

       

      I want get the consumer to receive all the messages send to node1(10.***.***.101), node2(10.***.***.102), but I don't know how to configure it, following is my context, could you please help me?

       

      1. HornetQ Version is 2.2.14Final

      2. Two HornetQ server with static connection, with the following kind of connection

       

       <clustered>true</clustered>
      
      <connector name="hornetq2.ec">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
                 <param key="host" value="hornetq2.ec" />
                 <param key="port" value="5445" />
      </connector>
      
       <cluster-connections>
            <cluster-connection name="my-cluster">
               <address>jms</address>
               <connector-ref>netty-connector</connector-ref>
               <retry-interval>500</retry-interval>
               <use-duplicate-detection>true</use-duplicate-detection>
               <forward-when-no-consumers>true</forward-when-no-consumers>
               <max-hops>1</max-hops>
               <static-connectors>
                  <connector-ref>hornetq2.ec</connector-ref>
               </static-connectors>
            </cluster-connection>
         </cluster-connections>
      

      3. Consumer with the following configure, only connect to one jms connection factory

       

                Hashtable<String, String> env1 = new Hashtable<String, String>();
                  env1.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
                  env1.put("java.naming.provider.url", "jnp://10.***.***.101:1099");
                  env1.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      
                  // Step 1. Create an initial context to perform the JNDI lookup.
                  initialContext1 = new InitialContext(env1);
      
                  // Step 2. Perfom a lookup on the queue
                  Queue queue = (Queue) initialContext1.lookup("/queue/OtherQueue");
      
                  // Step 3. Perform a lookup on the Connection Factory
                  ConnectionFactory cf1 = (ConnectionFactory) initialContext1.lookup("/ConnectionFactory");
      

       

      4. This consumer can only consumer the message from hornetQ server 10.***.***.101, cannot receive the message from hornetQ server 10.***.***.102

      5. How to config the consumer to receive all messages of the two hornetQ servers?

       

      Thanks

      Best Regards,

      Raysen Jia