1 Reply Latest reply on Jul 25, 2014 5:42 AM by anuradhap

    sending jms messages to server configured with full-ha profile

    anuradhap

      Hi,

      I have a master and slave configuration with Jboss 7.1.0. I also have configured for HornetQ clustering. Attached is my domain.xml.

      I have a MDB deployed to the server on full-ha.

      I'm trying to send messages using a standalone client, that is running in the same machine as the master server. I'm using HornetQ core api to send Jms messages to the queue on full-ha.

      Here is my code for it:

       

      Queue queue = HornetQJMSClient.createQueue("testQueue");

               

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

                map.put(org.hornetq.core.remoting.impl.netty.TransportConstants.HOST_PROP_NAME, "10.133.33.16");

       

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

       

                ConnectionFactory cf = (ConnectionFactory)HornetQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, transportConfiguration1);

       

                connection = cf.createConnection("test","password");

       

                Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

                MessageProducer producer = session.createProducer(queue); producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

       

       

      when i use HornetQJMSClient.createConnectionFactoryWithHA(), i get the below error:

      Failed to create session factory and Caused by: HornetQException[errorCode=3 message=Timed out waiting to receive cluster topology. Group:null]

       

      when i use  HornetQJMSClient.createConnectionFactoryWithoutHA() i'm able to send messages to the jms queue. I'm stuck here. May be there is something i'm unable to understand.

      I did all the settings mentioned in HornetQ clustering documentation from Jboss. Any help on this is highly appreciated.

        • 1. Re: sending jms messages to server configured with full-ha profile
          anuradhap

          i modified my client using Discovery Group as below:

          Queue queue = HornetQJMSClient.createQueue("testQueue");

                   

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

                    map.put(org.hornetq.core.remoting.impl.netty.TransportConstants.HOST_PROP_NAME, "10.133.33.16");

           

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

           

                    ConnectionFactory cf = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, transportConfiguration1);


                    DiscoveryGroupConfiguration discoveryGroup = new DiscoveryGroupConfiguration("231.7.7.7", 9876);

           

                    discoveryGroup.setDiscoveryInitialWaitTimeout(30000);

           

                    ConnectionFactory cf = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithHA(discoveryGroup, JMSFactoryType.CF);

                   connection = cf.createConnection("test","password");

           

                    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

           

           

                    MessageProducer producer = session.createProducer(queue); producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

           

           

          THis time i get an exception like this:

          Exception in thread "main" javax.jms.JMSException: Failed to create session factory

                  at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:605)

                  at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:119)

                  at com.nsn.training.MDBClientSender.main(MDBClientSender.java:45)

          Caused by: HornetQException[errorCode=3 message=Timed out waiting to receive initial broadcast from cluster]

                  at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:711)

                  at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:601)

                  ... 2 more