mirror of https://github.com/apache/activemq.git
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:
parent
dc168c055b
commit
62c28d1b77
|
@ -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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
Loading…
Reference in New Issue