0 Replies Latest reply on Jul 10, 2013 4:59 AM by erasmo2 marciano2

    JMS Queue Cluster consumer doesn't works correctly

    erasmo2 marciano2 Master

      HI

       

      I have this client Client Jms

       

                  Queue queue = new HornetQQueue("testQueue");

                  Map<String, Object> connectionParams = new HashMap<String, Object>();

                  connectionParams.put(TransportConstants.CLUSTER_CONNECTION, "231.7.7.7:9876");    

                  TransportConfiguration transportConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams);

                  ConnectionFactory cf = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(new DiscoveryGroupConfiguration(groupAddress, groupPort),

      JMSFactoryType.QUEUE_CF);    

       

       

      When i run the codes following:

       

                   MessageConsumer consumer = session.createConsumer(queue);

                  //Message can also be consumed from here:

                  for (int i = 0; i < 1000; i++) {  

                      message = (TextMessage) consumer.receive(3000);

                      LOGGER.info(message.getText());

                  }

       

       

      I consumer the messages only on JBOSSA ?

       

      Why does this happen?

       

      If I run my client Jms for second time  I consume the messages on JBOSSB

       

      add my code cluster-connections

       

      <cluster-connections>

                          <cluster-connection name="my-cluster">

                              <address>jms</address>

                              <connector-ref>netty</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>

                              <discovery-group-ref discovery-group-name="my-discovery-group"/>

                          </cluster-connection>

                      </cluster-connections>

       

       

       

       

      Thank You