From 62c28d1b77acb3d5b4363a4abf41130d1e97e5c1 Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Fri, 3 Mar 2006 17:20:19 +0000 Subject: [PATCH] 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 --- .../apache/activemq/broker/jmx/TopicView.java | 26 +++++++++++++++++++ .../activemq/broker/jmx/TopicViewMBean.java | 4 +++ 2 files changed, 30 insertions(+) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/TopicView.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/TopicView.java index 2f9d2086c7..2026ef9b19 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/TopicView.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/TopicView.java @@ -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); + + + } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/TopicViewMBean.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/TopicViewMBean.java index ce7ff33298..93d00f1cfe 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/TopicViewMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/TopicViewMBean.java @@ -34,5 +34,9 @@ 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; } \ No newline at end of file