0 Replies Latest reply on Oct 18, 2011 6:34 PM by alexc099

    Programatically creating JMS queues in standalone mode

    alexc099

      I've actually gotten this to work but I'm pretty sure I've come up with a dumb hack instead of a real solution here. Since I'm running in standalone mode the JMX examples don't work for me and my attempts to use the JMS management code, which looks like this:

       

      Queue mq = HornetQJMSClient.createQueue("hornetq.management");

      QueueRequestor rq = new QueueRequestor(session, mq);

      Message command = session.createMessage();

      JMSManagementHelper.putOperationInvocation(m, strDestination, "createQueue");

      Message reply = rq.request(command);

      Boolean itWorked = (Boolean)JMSManagementHelper.getResult(reply);

       

      result in a JMSSecurityException with user null not having permission to MANAGE. I have manage permisions for 'hornetq.management' added to the security settings in hornetq-configuration as well as createDurableQueue, createNonDurableQueue and createTempQueue permissions.

       

      My dumb hack, by the way, was to go into the core API, create a ClientSession and call

       

      createQueue("jms.queue." + strDestination, "jms.queue." + strDestination);

       

      From there I can call createQueue on the JMS session and get back a queue but I'm pretty sure that's not the best practice, is it?