Announcement Announcement Module
Collapse
No announcement yet.
Deleting Permanent queue from active mq broker Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Deleting Permanent queue from active mq broker

    Hi,

    Please suggest the compete and easy solution by spring JMS for Deleting Permanent queue from active mq broker.
    I tried goggled a lot but the solution is not working.Your kind help would be appreciated.

    In active mq broker there is a queue(queue exist) but void getQueues() of BrokerViewMBean is not returning any exception and even not deleting the queue.I can still see the queue in jconsole.Even after restarting the active mq broker.,i can see the queue in jconsole.I am able to send messages to queue and its enqueue count gets increased observed in jconsole.

    Please correct me if i am giving something wrong.Please let me know easy and short method for deleting permanent queue of active mq broker via JMX or by spring jms.

    In active mq broker there is a queue(queue exist) but getQueues() of BrokerViewMBean is not returning any queue.

    if i say
    ObjectName[] allQueues=mBean.getQueues();
    log.info("***number of found queues ****"+allQueues.length+"********");//printing o length

    mBean.removeQueue(queueName);//no exception/no output//jconsole still displaying the queue.Queue is not deleted.

    after executing the above removeQueue method,if i send messages i can see increased en-queue count in jconsole.That proves queue still exist and not deleted.

    here is full code :

    JMXConnector connector = null;
    MBeanServerConnection connection = null;

    String username = "";

    String password = "";

    Map env = new HashMap();
    String[] credentials = new String[] { username, password };
    env.put(JMXConnector.CREDENTIALS, credentials);

    try {
    log.info("RemoveMyDestination:Going to pass credentials ");
    connector = JMXConnectorFactory.newJMXConnector(new JMXServiceURL(amqJmxUrl), env);

    connector.connect();
    connection = connector.getMBeanServerConnection();
    log.info("RemoveMyDestination:Got connection ");
    } catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    ObjectName activeMQ = new ObjectName("org.apache.activemq:BrokerName=abc,Typ e=Broker");

    BrokerViewMBean mBean = (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(conn ection, activeMQ,BrokerViewMBean.class, true);

    log.info("Broker name given by mBean :"+mBean.getBrokerName());//printing correct broker name//abc

    ObjectName[] allQueues=mBean.getQueues();
    log.info("***number of found queues ****"+allQueues.length+"********");//printing o length

    mBean.removeQueue(queueName);//no exception/no output//jconsole still displaying the queue.


    Thanks and Regards,
    Sonal
Working...
X