You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by sonal sahu <so...@gmail.com> on 2012/12/04 15:15:25 UTC

BrokerViewMBean getQueues()method not returning list of queues

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

*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.*
*
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,Type=Broker");

BrokerViewMBean mBean = (BrokerViewMBean)
MBeanServerInvocationHandler.newProxyInstance(connection,
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



--
View this message in context: http://activemq.2283324.n4.nabble.com/BrokerViewMBean-getQueues-method-not-returning-list-of-queues-tp4660165.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.