mirror of https://github.com/apache/activemq.git
added some new MBean helper methods
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@687034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0a997b7eae
commit
52e15a48a1
|
@ -21,6 +21,9 @@ import javax.jms.InvalidSelectorException;
|
|||
import org.apache.activemq.broker.region.Subscription;
|
||||
import org.apache.activemq.command.ActiveMQDestination;
|
||||
import org.apache.activemq.command.ConsumerInfo;
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
import org.apache.activemq.command.ActiveMQTopic;
|
||||
import org.apache.activemq.filter.DestinationFilter;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.5 $
|
||||
|
@ -276,4 +279,30 @@ public class SubscriptionView implements SubscriptionViewMBean {
|
|||
return subscription != null ? subscription.getPrefetchSize() : 0;
|
||||
}
|
||||
|
||||
public boolean isMatchingQueue(String queueName) {
|
||||
if (isDestinationQueue()) {
|
||||
return matchesDestination(new ActiveMQQueue(queueName));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isMatchingTopic(String topicName) {
|
||||
if (isDestinationTopic()) {
|
||||
return matchesDestination(new ActiveMQTopic(topicName));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this subscription matches the given destination
|
||||
*
|
||||
* @param destination the destination to compare against
|
||||
* @return true if this subscription matches the given destination
|
||||
*/
|
||||
public boolean matchesDestination(ActiveMQDestination destination) {
|
||||
ActiveMQDestination subscriptionDestination = subscription.getActiveMQDestination();
|
||||
DestinationFilter filter = DestinationFilter.parseFilter(subscriptionDestination);
|
||||
return filter.matches(destination);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -154,4 +154,20 @@ public interface SubscriptionViewMBean {
|
|||
* consumers.
|
||||
*/
|
||||
String getSubcriptionName();
|
||||
|
||||
/**
|
||||
* Returns true if this subscription (which may be using wildcards) matches the given queue name
|
||||
*
|
||||
* @param queueName the JMS queue name to match against
|
||||
* @return true if this subscription matches the given queue or false if not
|
||||
*/
|
||||
boolean isMatchingQueue(String queueName);
|
||||
|
||||
/**
|
||||
* Returns true if this subscription (which may be using wildcards) matches the given topic name
|
||||
*
|
||||
* @param topicName the JMS topic name to match against
|
||||
* @return true if this subscription matches the given topic or false if not
|
||||
*/
|
||||
boolean isMatchingTopic(String topicName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue