Topic topic = session.createTopic("Test.Topic");
MessageConsumer consumer = session.createDurableSubscriber(topic, DURABLE_SUB_NAME);
consumer.close();
BrokerViewMBean brokerView = getBrokerView(DURABLE_SUB_NAME);
brokerView.destroyDurableSubscriber(CLIENT_ID, DURABLE_SUB_NAME);
}
private BrokerViewMBean getBrokerView(String testDurable) throws MalformedObjectNameException {
ObjectName brokerName = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost");
BrokerViewMBean view = (BrokerViewMBean) brokerService.getManagementContext().newProxyInstance(brokerName, BrokerViewMBean.class, true);