Repository: activemq
Updated Branches:
  refs/heads/trunk adb49f562 -> db1e3fc9e


AMQ-2429: Add pages listing producers for Queues and Topics.


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/db1e3fc9
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/db1e3fc9
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/db1e3fc9

Branch: refs/heads/trunk
Commit: db1e3fc9e375f6fa2692c2cc3d539af563063be7
Parents: adb49f5
Author: artnaseef <a...@artnaseef.com>
Authored: Fri Mar 14 19:52:03 2014 -0700
Committer: artnaseef <a...@artnaseef.com>
Committed: Fri Mar 14 19:53:53 2014 -0700

----------------------------------------------------------------------
 .../main/webapp/WEB-INF/webconsole-query.xml    |  2 +
 .../src/main/webapp/queueProducers.jsp          | 70 ++++++++++++++++++++
 activemq-web-console/src/main/webapp/queues.jsp |  2 +
 .../src/main/webapp/topicProducers.jsp          | 70 ++++++++++++++++++++
 activemq-web-console/src/main/webapp/topics.jsp |  2 +
 .../org/apache/activemq/web/BrokerFacade.java   | 24 ++++++-
 .../activemq/web/BrokerFacadeSupport.java       | 23 +++++++
 .../apache/activemq/web/QueueProducerQuery.java | 45 +++++++++++++
 .../apache/activemq/web/TopicProducerQuery.java | 45 +++++++++++++
 9 files changed, 282 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/db1e3fc9/activemq-web-console/src/main/webapp/WEB-INF/webconsole-query.xml
----------------------------------------------------------------------
diff --git a/activemq-web-console/src/main/webapp/WEB-INF/webconsole-query.xml 
b/activemq-web-console/src/main/webapp/WEB-INF/webconsole-query.xml
index 6a1fcf6..556d9b7 100644
--- a/activemq-web-console/src/main/webapp/WEB-INF/webconsole-query.xml
+++ b/activemq-web-console/src/main/webapp/WEB-INF/webconsole-query.xml
@@ -21,5 +21,7 @@
   <bean id="queueBrowser" class="org.apache.activemq.web.QueueBrowseQuery" 
autowire="constructor" destroy-method="destroy" scope="request"/>
   <bean id="messageQuery" class="org.apache.activemq.web.MessageQuery" 
autowire="constructor" destroy-method="destroy" scope="request"/>
   <bean id="queueConsumerQuery" 
class="org.apache.activemq.web.QueueConsumerQuery" autowire="constructor" 
destroy-method="destroy" scope="request"/>
+  <bean id="queueProducerQuery" 
class="org.apache.activemq.web.QueueProducerQuery" autowire="constructor" 
destroy-method="destroy" scope="request"/>
+  <bean id="topicProducerQuery" 
class="org.apache.activemq.web.TopicProducerQuery" autowire="constructor" 
destroy-method="destroy" scope="request"/>
   <bean id="connectionQuery" class="org.apache.activemq.web.ConnectionQuery" 
autowire="constructor" destroy-method="destroy" scope="request"/>
 </beans>

http://git-wip-us.apache.org/repos/asf/activemq/blob/db1e3fc9/activemq-web-console/src/main/webapp/queueProducers.jsp
----------------------------------------------------------------------
diff --git a/activemq-web-console/src/main/webapp/queueProducers.jsp 
b/activemq-web-console/src/main/webapp/queueProducers.jsp
new file mode 100644
index 0000000..724a76c
--- /dev/null
+++ b/activemq-web-console/src/main/webapp/queueProducers.jsp
@@ -0,0 +1,70 @@
+<%--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+   
+    http://www.apache.org/licenses/LICENSE-2.0
+   
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+--%>
+<html>
+<head>
+<c:set var="pageTitle" value="Producers for Queue 
${requestContext.queueProducerQuery.JMSDestination}"/>
+
+<%@include file="decorators/head.jsp" %>
+</head>
+<body>
+
+<%@include file="decorators/header.jsp" %>
+
+
+
+<h2>Active Producers for <c:out 
value="${requestContext.queueProducerQuery.JMSDestination}" /></h2>
+
+<table id="producers" class="sortable autostripe">
+<thead>
+<tr>
+       <th>
+               <span>Client ID</span>
+               <br/>
+               <span>Connection ID</span>
+       </th>
+       <th>SessionId</th>
+       <th>ProducerId</th>
+       <th>ProducerWindowSize</th>
+       <th>DispatchAsync</th>
+       <th>Blocked</th>
+       <th>BlockedTime</th>
+       <th>SentCount</th>
+</tr>
+</thead>
+<tbody>
+<c:forEach items="${requestContext.queueProducerQuery.producers}" var="row">
+<tr>
+       <td>
+        <a href="<c:url 
value="connection.jsp?connectionID=${row.clientId}"/>"><c:out 
value="${row.clientId}" /></a><br/>
+        <br>
+        <c:out value="${row.connectionId}" />
+    </td>
+       <td><c:out value="${row.sessionId}" /></td>
+       <td><c:out value="${row.producerId}" /></td>
+       <td><c:out value="${row.producerWindowSize}" /></td>
+       <td><c:out value="${row.dispatchAsync}" /></td>
+       <td><c:out value="${row.producerBlocked}" /></td>
+       <td><c:out value="${row.totalTimeBlocked}" /></td>
+       <td><c:out value="${row.sentCount}" /></td>
+</tr>
+</c:forEach>
+</tbody>
+</table>
+<%@include file="decorators/footer.jsp" %>
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/activemq/blob/db1e3fc9/activemq-web-console/src/main/webapp/queues.jsp
----------------------------------------------------------------------
diff --git a/activemq-web-console/src/main/webapp/queues.jsp 
b/activemq-web-console/src/main/webapp/queues.jsp
index 8b3a204..86e5772 100644
--- a/activemq-web-console/src/main/webapp/queues.jsp
+++ b/activemq-web-console/src/main/webapp/queues.jsp
@@ -66,6 +66,8 @@
                    <c:param name="JMSDestination" value="${row.name}" 
/></c:url>">Browse</a>
        <a href="<c:url value="queueConsumers.jsp">
                        <c:param name="JMSDestination" value="${row.name}" 
/></c:url>">Active Consumers</a><br/>
+       <a href="<c:url value="queueProducers.jsp">
+                       <c:param name="JMSDestination" value="${row.name}" 
/></c:url>">Active Producers</a><br/>
     <a href="<c:url value="queueBrowse/${row.name}">
                     <c:param name="view" value="rss" />
                     <c:param name="feedType" value="atom_1.0" />

http://git-wip-us.apache.org/repos/asf/activemq/blob/db1e3fc9/activemq-web-console/src/main/webapp/topicProducers.jsp
----------------------------------------------------------------------
diff --git a/activemq-web-console/src/main/webapp/topicProducers.jsp 
b/activemq-web-console/src/main/webapp/topicProducers.jsp
new file mode 100644
index 0000000..2a14077
--- /dev/null
+++ b/activemq-web-console/src/main/webapp/topicProducers.jsp
@@ -0,0 +1,70 @@
+<%--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+   
+    http://www.apache.org/licenses/LICENSE-2.0
+   
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+--%>
+<html>
+<head>
+<c:set var="pageTitle" value="Producers for Topic 
${requestContext.topicProducerQuery.JMSDestination}"/>
+
+<%@include file="decorators/head.jsp" %>
+</head>
+<body>
+
+<%@include file="decorators/header.jsp" %>
+
+
+
+<h2>Active Producers for <c:out 
value="${requestContext.topicProducerQuery.JMSDestination}" /></h2>
+
+<table id="producers" class="sortable autostripe">
+<thead>
+<tr>
+       <th>
+               <span>Client ID</span>
+               <br/>
+               <span>Connection ID</span>
+       </th>
+       <th>SessionId</th>
+       <th>ProducerId</th>
+       <th>ProducerWindowSize</th>
+       <th>DispatchAsync</th>
+       <th>Blocked</th>
+       <th>BlockedTime</th>
+       <th>SentCount</th>
+</tr>
+</thead>
+<tbody>
+<c:forEach items="${requestContext.topicProducerQuery.producers}" var="row">
+<tr>
+       <td>
+        <a href="<c:url 
value="connection.jsp?connectionID=${row.clientId}"/>"><c:out 
value="${row.clientId}" /></a><br/>
+        <br>
+        <c:out value="${row.connectionId}" />
+    </td>
+       <td><c:out value="${row.sessionId}" /></td>
+       <td><c:out value="${row.producerId}" /></td>
+       <td><c:out value="${row.producerWindowSize}" /></td>
+       <td><c:out value="${row.dispatchAsync}" /></td>
+       <td><c:out value="${row.producerBlocked}" /></td>
+       <td><c:out value="${row.totalTimeBlocked}" /></td>
+       <td><c:out value="${row.sentCount}" /></td>
+</tr>
+</c:forEach>
+</tbody>
+</table>
+<%@include file="decorators/footer.jsp" %>
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/activemq/blob/db1e3fc9/activemq-web-console/src/main/webapp/topics.jsp
----------------------------------------------------------------------
diff --git a/activemq-web-console/src/main/webapp/topics.jsp 
b/activemq-web-console/src/main/webapp/topics.jsp
index f964180..d44de08 100644
--- a/activemq-web-console/src/main/webapp/topics.jsp
+++ b/activemq-web-console/src/main/webapp/topics.jsp
@@ -61,6 +61,8 @@
     <a href="<c:url value="send.jsp">
                         <c:param name="JMSDestination" value="${row.name}" />
                         <c:param name="JMSDestinationType" 
value="topic"/></c:url>">Send To</a>
+    <a href="<c:url value="topicProducers.jsp">
+                        <c:param name="JMSDestination" value="${row.name}" 
/></c:url>">Active Producers</a><br/>
     <a href="<c:url value="deleteDestination.action">
                    <c:param name="JMSDestination" value="${row.name}" />
                    <c:param name="JMSDestinationType" value="topic"/>

http://git-wip-us.apache.org/repos/asf/activemq/blob/db1e3fc9/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java
----------------------------------------------------------------------
diff --git 
a/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java 
b/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java
index d4bf13a..c7e4d4a 100644
--- a/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java
+++ b/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacade.java
@@ -73,6 +73,28 @@ public interface BrokerFacade {
                        throws Exception;
 
        /**
+        * All active producers to a queue.
+        * 
+        * @param queueName
+        *            the name of the queue, not <code>null</code>
+        * @return not <code>null</code>
+        * @throws Exception
+        */
+       Collection<ProducerViewMBean> getQueueProducers(String queueName)
+                       throws Exception;
+
+       /**
+        * All active producers to a topic.
+        * 
+        * @param queueName
+        *            the name of the topic, not <code>null</code>
+        * @return not <code>null</code>
+        * @throws Exception
+        */
+       Collection<ProducerViewMBean> getTopicProducers(String queueName)
+                       throws Exception;
+
+       /**
         * Active durable subscribers to topics of the broker.
         * 
         * @return not <code>null</code>
@@ -209,4 +231,4 @@ public interface BrokerFacade {
 
     boolean isJobSchedulerStarted();
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/db1e3fc9/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
----------------------------------------------------------------------
diff --git 
a/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java 
b/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
index babd892..aa2006a 100644
--- 
a/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
+++ 
b/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
@@ -39,6 +39,7 @@ import org.apache.activemq.broker.jmx.NetworkBridgeViewMBean;
 import org.apache.activemq.broker.jmx.NetworkConnectorViewMBean;
 import org.apache.activemq.broker.jmx.QueueViewMBean;
 import org.apache.activemq.broker.jmx.SubscriptionViewMBean;
+import org.apache.activemq.broker.jmx.ProducerViewMBean;
 import org.apache.activemq.broker.jmx.TopicViewMBean;
 import org.springframework.util.StringUtils;
 
@@ -218,6 +219,28 @@ public abstract class BrokerFacadeSupport implements 
BrokerFacade {
 
     @Override
     @SuppressWarnings("unchecked")
+    public Collection<ProducerViewMBean> getQueueProducers(String queueName) 
throws Exception {
+        String brokerName = getBrokerName();
+        queueName = StringUtils.replace(queueName, "\"", "_");
+        ObjectName query = new 
ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerName
+                + ",destinationType=Queue,destinationName=" + queueName + 
",endpoint=Producer,*");
+        Set<ObjectName> queryResult = queryNames(query, null);
+        return getManagedObjects(queryResult.toArray(new 
ObjectName[queryResult.size()]), ProducerViewMBean.class);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Collection<ProducerViewMBean> getTopicProducers(String topicName) 
throws Exception {
+        String brokerName = getBrokerName();
+        topicName = StringUtils.replace(topicName, "\"", "_");
+        ObjectName query = new 
ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerName
+                + ",destinationType=Topic,destinationName=" + topicName + 
",endpoint=Producer,*");
+        Set<ObjectName> queryResult = queryNames(query, null);
+        return getManagedObjects(queryResult.toArray(new 
ObjectName[queryResult.size()]), ProducerViewMBean.class);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
     public Collection<SubscriptionViewMBean> getConsumersOnConnection(String 
connectionName) throws Exception {
         connectionName = StringUtils.replace(connectionName, ":", "_");
         String brokerName = getBrokerName();

http://git-wip-us.apache.org/repos/asf/activemq/blob/db1e3fc9/activemq-web/src/main/java/org/apache/activemq/web/QueueProducerQuery.java
----------------------------------------------------------------------
diff --git 
a/activemq-web/src/main/java/org/apache/activemq/web/QueueProducerQuery.java 
b/activemq-web/src/main/java/org/apache/activemq/web/QueueProducerQuery.java
new file mode 100644
index 0000000..b5ca8c9
--- /dev/null
+++ b/activemq-web/src/main/java/org/apache/activemq/web/QueueProducerQuery.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.web;
+
+import java.util.Collection;
+
+import javax.jms.JMSException;
+
+import org.apache.activemq.broker.jmx.ProducerViewMBean;
+
+/**
+ * Query for Queue producers.
+ * 
+ * 
+ */
+public class QueueProducerQuery extends DestinationFacade {
+
+       public QueueProducerQuery(BrokerFacade brokerFacade) throws 
JMSException {
+               super(brokerFacade);
+               setJMSDestinationType("queue");
+       }
+
+       public Collection<ProducerViewMBean> getProducers() throws Exception {
+               return getBrokerFacade().getQueueProducers(getJMSDestination());
+       }
+
+       public void destroy() {
+               // empty
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/db1e3fc9/activemq-web/src/main/java/org/apache/activemq/web/TopicProducerQuery.java
----------------------------------------------------------------------
diff --git 
a/activemq-web/src/main/java/org/apache/activemq/web/TopicProducerQuery.java 
b/activemq-web/src/main/java/org/apache/activemq/web/TopicProducerQuery.java
new file mode 100644
index 0000000..e645c27
--- /dev/null
+++ b/activemq-web/src/main/java/org/apache/activemq/web/TopicProducerQuery.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.web;
+
+import java.util.Collection;
+
+import javax.jms.JMSException;
+
+import org.apache.activemq.broker.jmx.ProducerViewMBean;
+
+/**
+ * Query for Topic producers.
+ * 
+ * 
+ */
+public class TopicProducerQuery extends DestinationFacade {
+
+       public TopicProducerQuery(BrokerFacade brokerFacade) throws 
JMSException {
+               super(brokerFacade);
+               setJMSDestinationType("queue");
+       }
+
+       public Collection<ProducerViewMBean> getProducers() throws Exception {
+               return getBrokerFacade().getTopicProducers(getJMSDestination());
+       }
+
+       public void destroy() {
+               // empty
+       }
+
+}

Reply via email to