1 Reply Latest reply on Aug 6, 2010 4:32 AM by Jeff Mesnil

    Clustering programmatically created queues fails.

    Joe Schmoe Newbie

      I have a HornetQ cluster setup between two nodes, and clustering is working fine on queues statically defined in hornetq-configuration.xml.


      However, I also need to cluster programatically created queues that match the address-setting in the cluster configuration.  However, it does not appear to be working even when I am also creating the queue on the second node.


      Here is the configuration for the cluster in the hornetq-configuration.xml:


                <!-- Task queue cluster. -->
            <cluster-connection name="lf-cluster">
               <discovery-group-ref discovery-group-name="lf-discovery-group" />


      I am programmatically creating the queues like so:



      Session session = null;
                try {
                     Queue managementQueue = new HornetQQueue("hornetq.management");
                     session = taskQueueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                     QueueRequestor requestor = new QueueRequestor((QueueSession) session, managementQueue);
                     Message msg = session.createMessage();
                     JMSManagementHelper.putOperationInvocation(msg, "jms.server",
                                "createQueue", JMS_QUEUE_NAME_PREFIX + task.getQueueName(), JMS_QUEUE_JNDI_PREFIX + task.getQueueName());
                     Message reply = requestor.request(msg);
                     boolean success = JMSManagementHelper.hasOperationSucceeded(reply);
                     if (!success)
                          throw new RuntimeException("Unable to open queue tasks because the queue could not be created.");
                     // Replicate queue to node 2.
                } catch (JMSException e) {
                     String msg = "Fatal JMSException caught attempting to create task queue!!";
                     log.fatal(msg, e);
                     throw new RuntimeException(msg, e);
                } finally {
                     if (session != null) { try { session.close(); } catch (JMSException e) {} }



      The full queue name the code above is creating will be:  jms.queue.tasks.taskQueue1.  I would expect the address on the cluster configuration to match and to start clustering that queue.


      And yes, there are consumers on the node2 queue.


      Am I missing something here?