Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

HORNETQ-1372 & BZ1113908 - TopicControl.listDurableSubscriptionsAsJSON d... #1714

Merged
merged 1 commit into from

2 participants

@jbertram
Owner

...oes not work with heirarchical topics

@clebertsuconic clebertsuconic merged commit 57dad92 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 17, 2014
  1. @jbertram

    HORNETQ-1372 & BZ1113908 - TopicControl.listDurableSubscriptionsAsJSO…

    jbertram authored
    …N does not work with heirarchical topics
This page is out of date. Refresh to see the latest.
View
10 hornetq-jms-server/src/main/java/org/hornetq/jms/management/impl/JMSTopicControlImpl.java
@@ -315,13 +315,21 @@ private String listSubscribersInfosAsJSON(final DurabilityType durability) throw
String clientID = null;
String subName = null;
- if (queue.isDurable())
+ if (queue.isDurable() && !queue.getName().startsWith(ResourceNames.JMS_TOPIC))
{
Pair<String, String> pair = HornetQDestination.decomposeQueueNameForDurableSubscription(queue.getName()
.toString());
clientID = pair.getA();
subName = pair.getB();
}
+ else if (queue.getName().startsWith(ResourceNames.JMS_TOPIC))
+ {
+ // in the case of heirarchical topics the queue name will not follow the <part>.<part> pattern of normal
+ // durable subscribers so skip decomposing the name for the client ID and subscription name and just
+ // hard-code it
+ clientID = "HornetQ";
+ subName = "HornetQ";
+ }
String filter = queue.getFilter() != null ? queue.getFilter() : null;
View
15 ...ntegration-tests/src/test/java/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java
@@ -201,6 +201,21 @@ public void testListXXXSubscriptionsAsJSON() throws Exception
}
@Test
+ public void testListSubscriptionsAsJSONWithHierarchicalTopics() throws Exception
+ {
+ serverManager.createTopic(false, "my.jms.#", "jms/all");
+ serverManager.createTopic(false, "my.jms.A", "jms/A");
+ HornetQTopic myTopic = (HornetQTopic) HornetQJMSClient.createTopic("my.jms.A");
+
+ TopicControl topicControl = ManagementControlHelper.createTopicControl(myTopic, mbeanServer);
+ String jsonString = topicControl.listDurableSubscriptionsAsJSON();
+ SubscriptionInfo[] infos = SubscriptionInfo.from(jsonString);
+ Assert.assertEquals(1, infos.length);
+ Assert.assertEquals("HornetQ", infos[0].getClientID());
+ Assert.assertEquals("HornetQ", infos[0].getName());
+ }
+
+ @Test
public void testCountMessagesForSubscription() throws Exception
{
String key = "key";
Something went wrong with that request. Please try again.