我尝试了以下操作,其中brokerService
是可以假定通过调用brokerService.start()
来启动的代理:
ActiveMQDestination[] dests = brokerService.getDestinations();
但是,dests
为空。我也尝试过:
Broker broker = brokerService.getBroker();
Map<ActiveMQDestination, Destination> destMap = broker.getDestinationMap();
Iterator<ActiveMQDestination> destMapIter = destMap.keySet.iterator();
while(destMapIter.hasNext()) {
ActiveMQDestination activeMQDest = destMapIter.next();
brokerService.removeDestination(activeMQDest);
}
但这给了我以下例外:
javax.jms.JMSException: Destination still has an active subscription: queue://<queue name>
除了主要问题外,我也不知道如何以编程方式终止订阅。