5 Replies Latest reply on Jan 8, 2013 3:11 AM by Andy Taylor

    Jboss7, 2.2.13 hornetq- createConnection takes a long time unless using a cached HornetQConnectionFactory

    kperry Newbie

      We have clustered hornetq setup where our client is a web service setup on a jboss box (JbossWs1) and then we have two clustered, remote jms nodes, (I will call JbossJms1 and JbossJms2).

       

      For the group config we are using port and UDP address.  If we leave the HornetQJMSClient.createConnection call in for every call, it can take anywhere from 700ms to 7 seconds and probably averages somewhere around 4.5 seconds for the createConnection call - note the connectionFactory doesn't take any longer to create just the createConnection.

       

      If we cache the jmsConnectionFactory as a static final on the class, then it works as expected...almost instantaneos (under 100ms for sure).  Our producer code is running on our JbossWs1 box. The snippet is below:

       

                // Step 1. Get connection through HornetQ
      
                  LOG.info("[1]Start connection factory");
                  HornetQConnectionFactory jmsConnectionFactory = HornetQJMSClient.createConnectionFactoryWithoutHA(GROUP_CONFIG, JMSFactoryType.QUEUE_CF);
                  LOG.info("[1]Finish connection factory");
      
      
                  LOG.info("[2]Create connection");
                  Connection connection = jmsConnectionFactory.createConnection();
                  LOG.info("[2]Finish create connection");
      
      
                  LOG.info("[3] Create session");
                  // Step 2. Create a JMS Session
                  Session session = connection.createSession(false,
                                                        Session.AUTO_ACKNOWLEDGE);
                  LOG.info("[3] finish create session");
      
      
                  LOG.info("[4] Create lookup on queue");
                  // Step 3. Perform a lookup on the queue
                  Queue destQueue = session.createQueue(destinationQueue);
                  LOG.info("[4] Finish Create lookup on queue");
      
      
                  LOG.info("[5] Create Producer");
                  // Step 4. Create a JMS Message Producer
                  producer = session.createProducer(destQueue);
                  LOG.info("[5] Finish Create Producer");
      
      
      

      Note: This is a change from behavior from 2.2.5 and jboss 6 - we never had this issue before.  Is this expected behavior?