2 Replies Latest reply on Apr 21, 2004 1:36 AM by stephanenicoll

    Programmatically create queue

    nilsson

      I needed to create a queue programatically

      Presumably there are other samples in this forum already, but if you are incompetent like me, and can't make them work here is some help. I am sure the other samples are OK, and it's my incompetence that maked me unable to usen them, not the fact that they are from 2001.

      I used this piece of code running from a separate JVM (application) creating a queue in JBoss 3.2.2

      InitialContext ic;
      RMIAdaptor server;

      ObjectName name;
      MBeanInfo info;

      ic = new InitialContext();

      server = (RMIAdaptor) ic.lookup("jmx/rmi/RMIAdaptor");

      // Create a queue
      String queueName;
      String queueJndiName;

      queueName = "A New queue";
      queueJndiName = "queue/new";

      String[] signature = {"java.lang.String", "java.lang.String"};
      Object[] arguments = {queueName, queueJndiName};

      name = new ObjectName("jboss.mq:service=DestinationManager");
      server.invoke(name, "createQueue", arguments, signature);