1 Reply Latest reply on Nov 4, 2014 10:51 AM by Justin Bertram

    Queue and Topic destroy is not working using "JMSManagementHelper.putOperationInvocation"

    shyla_raj Newbie

      I am trying to create a topic and delete it  programmatically.

      Below code is working for "createTopic" operation invocation.

      But when I try to use the same "JMSManagementHelper.putOperationInvocation" call to delete topic with string "destroyTopic".....it gives IllegalArgumentException on the serveside.

       

      Our HornetQ server is version 2.3.1 Final. I read somewhere that "destroyQueue" is not in 2.3.1. Is that correct?

      If there is a solution or workaround for deleting queue/topic that was created programmatically for 2.3.1..Please let me know. Thank you!

       

       

      InitialContext initialContext = JMSUtils.getInitialContext(username, password, providerURL);

      QueueConnectionFactory cf = (QueueConnectionFactory) initialContext.lookup(REMOTE_CONN_FACTORY_NAME);

      QueueConnection connection = cf.createQueueConnection(username, password);

      QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

      connection.start();

       

      Message m = session.createMessage();

      JMSManagementHelper.putOperationInvocation(m, "jms.server", "createTopic", topicName,  "jboss/exported/jms/topic/" + topicName);

       

      //Use the requestor to send the request and wait for the reply

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

      QueueRequestor requestor = new QueueRequestor(session, managementQueue);

      Message reply = requestor.request(m);

       

       

      Thank you!

      Shyla