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

This commit is contained in:
artnaseef 2014-03-14 19:52:03 -07:00
parent adb49f5627
commit db1e3fc9e3
9 changed files with 282 additions and 1 deletions

View File

@ -21,5 +21,7 @@
<bean id="queueBrowser" class="org.apache.activemq.web.QueueBrowseQuery" autowire="constructor" destroy-method="destroy" scope="request"/> <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="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="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"/> <bean id="connectionQuery" class="org.apache.activemq.web.ConnectionQuery" autowire="constructor" destroy-method="destroy" scope="request"/>
</beans> </beans>

View File

@ -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>

View File

@ -66,6 +66,8 @@
<c:param name="JMSDestination" value="${row.name}" /></c:url>">Browse</a> <c:param name="JMSDestination" value="${row.name}" /></c:url>">Browse</a>
<a href="<c:url value="queueConsumers.jsp"> <a href="<c:url value="queueConsumers.jsp">
<c:param name="JMSDestination" value="${row.name}" /></c:url>">Active Consumers</a><br/> <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}"> <a href="<c:url value="queueBrowse/${row.name}">
<c:param name="view" value="rss" /> <c:param name="view" value="rss" />
<c:param name="feedType" value="atom_1.0" /> <c:param name="feedType" value="atom_1.0" />

View File

@ -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>

View File

@ -61,6 +61,8 @@
<a href="<c:url value="send.jsp"> <a href="<c:url value="send.jsp">
<c:param name="JMSDestination" value="${row.name}" /> <c:param name="JMSDestination" value="${row.name}" />
<c:param name="JMSDestinationType" value="topic"/></c:url>">Send To</a> <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"> <a href="<c:url value="deleteDestination.action">
<c:param name="JMSDestination" value="${row.name}" /> <c:param name="JMSDestination" value="${row.name}" />
<c:param name="JMSDestinationType" value="topic"/> <c:param name="JMSDestinationType" value="topic"/>

View File

@ -72,6 +72,28 @@ public interface BrokerFacade {
Collection<SubscriptionViewMBean> getQueueConsumers(String queueName) Collection<SubscriptionViewMBean> getQueueConsumers(String queueName)
throws Exception; 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. * Active durable subscribers to topics of the broker.
* *
@ -209,4 +231,4 @@ public interface BrokerFacade {
boolean isJobSchedulerStarted(); boolean isJobSchedulerStarted();
} }

View File

@ -39,6 +39,7 @@ import org.apache.activemq.broker.jmx.NetworkBridgeViewMBean;
import org.apache.activemq.broker.jmx.NetworkConnectorViewMBean; import org.apache.activemq.broker.jmx.NetworkConnectorViewMBean;
import org.apache.activemq.broker.jmx.QueueViewMBean; import org.apache.activemq.broker.jmx.QueueViewMBean;
import org.apache.activemq.broker.jmx.SubscriptionViewMBean; import org.apache.activemq.broker.jmx.SubscriptionViewMBean;
import org.apache.activemq.broker.jmx.ProducerViewMBean;
import org.apache.activemq.broker.jmx.TopicViewMBean; import org.apache.activemq.broker.jmx.TopicViewMBean;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
@ -216,6 +217,28 @@ public abstract class BrokerFacadeSupport implements BrokerFacade {
return getManagedObjects(queryResult.toArray(new ObjectName[queryResult.size()]), SubscriptionViewMBean.class); return getManagedObjects(queryResult.toArray(new ObjectName[queryResult.size()]), SubscriptionViewMBean.class);
} }
@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 @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Collection<SubscriptionViewMBean> getConsumersOnConnection(String connectionName) throws Exception { public Collection<SubscriptionViewMBean> getConsumersOnConnection(String connectionName) throws Exception {

View File

@ -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
}
}

View File

@ -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
}
}