1 Reply Latest reply on Apr 2, 2007 12:34 PM by Clebert Suconic

    Managing JMS using JMS

    Adrian Brock Master

      I suggested this before, but I don't think I wrote it up fully in the forums
      so here goes.

      It should be possible to manage JMS using JMS,
      i.e. create queues, topics, connection factories by sending messages to
      a management queue (which is suitably secured).

      It would then possible to do something like:

      queue = (Queue) jndi.lookup(JBossJMS.ManagementQueueName):
      QueueRequestor r = new QueueRequestor(session, queue);
      Message request = session.createMessage();
      request.setStringProperty(JBossJMS.OPERATION, JBossJMS.CREATE_QUEUE);
      request.setStringProperty(JBossJMS.DESTINATION_NAME, "myQueue");
      request.setIntegerProperty(JBossJMS.QUEUE_DEPTH, 1000);
      // etc.
      Message response = r.request(m);
      // check the response
      


      More likely would create a class that does all this boiler plate for you,
      e.g.
      manager = new JBossJMSManagement(session);
      QueueTemplate template = manager.createQueueTemplate();
      template.setQueueDepth(1000);
      manager.createQueue("myQueue", template);
      


      Once this is done, JBossMQ could also implement a queue
      that handles the same requests which would provide portability across releases.

      This is superior to the JMX approach since it will also work "remotely".
      In fact, the location of the jms server is transparent and automatic
      based on the connection factory the user looks up.

      If this had been done when I first requested it, people could have already been
      using it.