Added methods to create/destroy durable subscriber

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@382890 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2006-03-03 17:20:19 +00:00
parent dc168c055b
commit 62c28d1b77
2 changed files with 30 additions and 0 deletions

View File

@ -13,10 +13,36 @@
*/
package org.apache.activemq.broker.jmx;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.broker.region.Topic;
import org.apache.activemq.command.ConsumerInfo;
import org.apache.activemq.command.RemoveSubscriptionInfo;
public class TopicView extends DestinationView implements TopicViewMBean{
public TopicView(ManagedRegionBroker broker, Topic destination){
super(broker, destination);
}
public void createDurableSubscriber(String clientId,String subscriberName) throws Exception{
ConnectionContext context = new ConnectionContext();
context.setBroker(broker);
context.setClientId(clientId);
ConsumerInfo info = new ConsumerInfo();
info.setDestination(destination.getActiveMQDestination());
info.setSubcriptionName(subscriberName);
broker.addConsumer(context, info);
broker.removeConsumer(context, info);
}
public void destroyDurableSubscriber(String clientId,String subscriberName) throws Exception{
RemoveSubscriptionInfo info = new RemoveSubscriptionInfo();
info.setClientId(clientId);
info.setSubcriptionName(subscriberName);
ConnectionContext context = new ConnectionContext();
context.setBroker(broker);
context.setClientId(clientId);
broker.removeSubscription(context, info);
}
}

View File

@ -35,4 +35,8 @@ public interface TopicViewMBean {
public CompositeData[] browse() throws OpenDataException;
public TabularData browseAsTable() throws OpenDataException;
public void createDurableSubscriber(String clientId,String subscriberName) throws Exception;
public void destroyDurableSubscriber(String clientId,String subscriberName) throws Exception;
}