Hi Tim, You are right, after providing the topic information, I was able to browse the messages and call the removeMessage(String JMSMessageID) on them.
However, On recursive testing, I found after few iterations the removeMessage won't work and the message is not deleted from the topic. Following is the code to delete the messages: MBeanServerConnection conn = JMXConnectorFactory.connect(new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi")).getMBeanServerConnection(); ObjectName broker = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost"); BrokerViewMBean brokerViewMBean = MBeanServerInvocationHandler.newProxyInstance(conn, broker, BrokerViewMBean.class, true); for (ObjectName topics : brokerViewMBean.getTopics()) { if (topics.getKeyProperty("destinationName").equals("TestTopic")) { TopicViewMBean topicViewMBean = MBeanServerInvocationHandler.newProxyInstance(conn, topics, TopicViewMBean.class, true); for (ObjectName name : topicViewMBean.getSubscriptions()) { DurableSubscriptionViewMBean viewMBean = MBeanServerInvocationHandler.newProxyInstance(conn, name, DurableSubscriptionViewMBean.class, true); for (CompositeData data : viewMBean.browse()) { viewMBean.removeMessage((String) data.get("JMSMessageID")); } } } } After removeMessages, if I do getPendingQueueSize(), I still find it to be the same as it was before delete. I even did a recursive check till the pending count is not 0, but still it wont work. Do you think there's any configuration which might cause this behavior? I feel this code should do the trick, but still somewhere something is missing and I can't figure out what... -- View this message in context: http://activemq.2283324.n4.nabble.com/JAVA-ActiveMQ-JMX-browse-messages-on-Topic-tp4729813p4729893.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.