10 Replies Latest reply on Feb 5, 2013 12:38 PM by Justin Bertram

    Create queues and topics at run-time

    st.bolli Newbie

      Hi all,

            I am a newbie with HornetQ 2.1.2.Final on Jboss 5.1.0AS

       

      I need to dynamically create queues (and eventually topics) from the Java code at run-time. After their creation it is necessary for my purpose to register the created queues on JNDI.

       

      Surfing the forum I find the following solution, but it is not clear to me how to bind the created queue to the JNDI bind("jndiString", what object?)

       

              ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(NettyConnectorFactory.class.getName()));

              ClientSession coreSession = sf.createSession(false, false, false);

              String queueName = "jms.queue.example00";

              coreSession.deleteQueue(queueName);

              coreSession.createQueue(queueName, queueName, true);

       

      How can be binded the created queue to JNDI?

      Are there any other possible solution for the same purpose?

       

      Thanks!