/** * Invoked when a message cache is created. * * @param destination the destination that messages are being cached for * @param cache the corresponding cache */ public void cacheAdded(JmsDestination destination, DestinationCache cache) { if (destination instanceof JmsTopic) { JmsTopic myTopic = (JmsTopic) getDestination(); JmsTopic topic = (JmsTopic) destination; if (myTopic.match(topic) && !_caches.containsKey(topic)) { _caches.put(topic, cache); cache.addConsumer(this); } } }
/** * Determines if this consumer can consume messages from the specified destination. * * @param destination the destination * @return <code>true</code> if the consumer can consume messages from <code>destination</code>; * otherwise <code>false</code> */ public boolean canConsume(JmsDestination destination) { boolean result = false; if (destination instanceof JmsTopic) { JmsTopic topic = (JmsTopic) getDestination(); if (!topic.isWildCard()) { result = super.canConsume(destination); } else { result = topic.match((JmsTopic) destination); } } return result; }