Author: clebert.suconic(a)jboss.com
Date: 2010-12-27 13:42:39 -0500 (Mon, 27 Dec 2010)
New Revision: 10074
Modified:
trunk/src/main/org/hornetq/api/jms/management/JMSQueueControl.java
trunk/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
Log:
HORNETQ-587 - adding listConsumersAsJSON on JMSQueueControl
Modified: trunk/src/main/org/hornetq/api/jms/management/JMSQueueControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/management/JMSQueueControl.java 2010-12-27 18:30:58
UTC (rev 10073)
+++ trunk/src/main/org/hornetq/api/jms/management/JMSQueueControl.java 2010-12-27 18:42:39
UTC (rev 10074)
@@ -71,7 +71,7 @@
*/
@Operation(desc = "Returns the list of JNDI bindings associated")
String[] getJNDIBindings();
-
+
/**
* Add the JNDI binding to this destination
*/
@@ -212,7 +212,6 @@
@Operation(desc = "Reset the message counters", impact =
MBeanOperationInfo.INFO)
void resetMessageCounter() throws Exception;
-
/**
* Lists the message counter for this queue as a HTML table.
*/
@@ -249,4 +248,7 @@
@Operation(desc = "Resume the queue.", impact = MBeanOperationInfo.ACTION)
void resume() throws Exception;
+ @Operation(desc = "List all the existent consumers on the Queue")
+ String listConsumersAsJSON() throws Exception;
+
}
Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java 2010-12-27
18:30:58 UTC (rev 10073)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java 2010-12-27
18:42:39 UTC (rev 10074)
@@ -21,6 +21,7 @@
import org.hornetq.api.core.FilterConstants;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.management.MessageCounterInfo;
+import org.hornetq.api.core.management.Operation;
import org.hornetq.api.core.management.QueueControl;
import org.hornetq.api.jms.management.JMSQueueControl;
import org.hornetq.core.logging.Logger;
@@ -49,7 +50,7 @@
// Attributes ----------------------------------------------------
private final HornetQDestination managedQueue;
-
+
private final JMSServerManager jmsServerManager;
private final QueueControl coreQueueControl;
@@ -172,13 +173,12 @@
{
jmsServerManager.addQueueToJndi(managedQueue.getName(), jndi);
}
-
+
public String[] getJNDIBindings()
{
return jmsServerManager.getJNDIOnQueue(managedQueue.getName());
}
-
public boolean removeMessage(final String messageID) throws Exception
{
String filter = JMSQueueControlImpl.createFilterForJMSMessageID(messageID);
@@ -302,6 +302,12 @@
return coreQueueControl.moveMessages(filter, otherQueue.getAddress());
}
+ @Operation(desc = "List all the existent consumers on the Queue")
+ public String listConsumersAsJSON() throws Exception
+ {
+ return coreQueueControl.listConsumersAsJSON();
+ }
+
public String listMessageCounter()
{
try
Modified:
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2010-12-27
18:30:58 UTC (rev 10073)
+++
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2010-12-27
18:42:39 UTC (rev 10074)
@@ -98,6 +98,10 @@
MessageConsumer consumer = JMSUtil.createConsumer(connection, queue);
Assert.assertEquals(1, queueControl.getConsumerCount());
+
+ JSONArray jsonArray = new JSONArray(queueControl.listConsumersAsJSON());
+
+ assertEquals(1, jsonArray.length());
JMSUtil.sendMessages(queue, 2);
Modified:
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java 2010-12-27
18:30:58 UTC (rev 10073)
+++
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java 2010-12-27
18:42:39 UTC (rev 10074)
@@ -13,7 +13,6 @@
package org.hornetq.tests.integration.jms.server.management;
-import java.util.List;
import java.util.Map;
import javax.jms.QueueConnection;
@@ -27,7 +26,6 @@
import org.hornetq.api.jms.management.JMSQueueControl;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.jms.client.HornetQConnectionFactory;
-import org.hornetq.jms.client.HornetQDestination;
import org.hornetq.jms.client.HornetQQueue;
/**
@@ -285,6 +283,11 @@
// TODO: Add a test for this
return null;
}
+
+ public String listConsumersAsJSON() throws Exception
+ {
+ return (String)proxy.invokeOperation("listConsumersAsJSON");
+ }
};
}
Show replies by date