public List<ConsumerInfo> getMatchingConsumerList(String messageString) { List<ConsumerInfo> matchingConsumerList = new LinkedList<ConsumerInfo>(); XMLTree tree = new XMLTree(new java.io.StringReader(messageString)); if (WSMGParameter.debugYFilter) tree.print(); yfilter.setEventSequence(tree.getEvents()); yfilter.startParsing(); // print the matched queries // if (SystemGlobals.hasQueries) { if (WSMGParameter.debugYFilter) yfilter.printQueryResults(System.out); } else { System.out.println("no match"); return matchingConsumerList; } Iterator<Integer> it = (Iterator<Integer>) yfilter.getMatchedQueries().iterator(); while (it.hasNext()) { Integer qid = it.next(); String xpath = yFilterIdToXPath.get(qid); ConsumerList consumerList = consumerListmanager.getConsumerListByToken(xpath); if (consumerList != null) { // has subscription to this topic matchingConsumerList.addAll(consumerList.getConsumerList()); } } yfilter.clear(); return matchingConsumerList; }
public int removeSubscription(String subscriptionId) { String xPath = consumerListmanager.getTokenBySubscriptionId(subscriptionId); int result = consumerListmanager.removeFromConsumerList(subscriptionId, xPath); if (result == 0) { return 0; } int currentConsumerCount = consumerListmanager.getConsumerListByToken(xPath).size(); if (currentConsumerCount == 0) { Integer yFilterId = xPathToYFilterId.get(xPath); Query q = yFilterIdToQuery.get(yFilterId); yfilter.deleteQuery(q, q.getQueryId()); yFilterIdToQuery.remove(yFilterId); } counter--; return result; }