@Override
  public int removeMessages(final String filterStr) throws Exception {
    String filter = JMSTopicControlImpl.createFilterFromJMSSelector(filterStr);
    int count = 0;
    String[] queues = addressControl.getQueueNames();
    for (String queue : queues) {
      QueueControl coreQueueControl =
          (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queue);
      if (coreQueueControl != null) {
        count += coreQueueControl.removeMessages(filter);
      }
    }

    return count;
  }
 @Override
 public int countMessagesForSubscription(
     final String clientID, final String subscriptionName, final String filterStr)
     throws Exception {
   String queueName =
       ActiveMQDestination.createQueueNameForDurableSubscription(true, clientID, subscriptionName);
   QueueControl coreQueueControl =
       (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queueName);
   if (coreQueueControl == null) {
     throw new IllegalArgumentException(
         "No subscriptions with name " + queueName + " for clientID " + clientID);
   }
   String filter = JMSTopicControlImpl.createFilterFromJMSSelector(filterStr);
   return coreQueueControl.listMessages(filter).length;
 }