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 6a1fcf6045..556d9b7fe7 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 @@ + + 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 0000000000..724a76cee2 --- /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. +--%> + + + + +<%@include file="decorators/head.jsp" %> + + + +<%@include file="decorators/header.jsp" %> + + + +

Active Producers for

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Client ID +
+ Connection ID +
SessionIdProducerIdProducerWindowSizeDispatchAsyncBlockedBlockedTimeSentCount
+ ">
+
+ +
+<%@include file="decorators/footer.jsp" %> + + + diff --git a/activemq-web-console/src/main/webapp/queues.jsp b/activemq-web-console/src/main/webapp/queues.jsp index 8b3a2044cd..86e5772433 100644 --- a/activemq-web-console/src/main/webapp/queues.jsp +++ b/activemq-web-console/src/main/webapp/queues.jsp @@ -66,6 +66,8 @@ ">Browse ">Active Consumers
+ + ">Active Producers
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 0000000000..2a140773d1 --- /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. +--%> + + + + +<%@include file="decorators/head.jsp" %> + + + +<%@include file="decorators/header.jsp" %> + + + +

Active Producers for

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Client ID +
+ Connection ID +
SessionIdProducerIdProducerWindowSizeDispatchAsyncBlockedBlockedTimeSentCount
+ ">
+
+ +
+<%@include file="decorators/footer.jsp" %> + + + diff --git a/activemq-web-console/src/main/webapp/topics.jsp b/activemq-web-console/src/main/webapp/topics.jsp index f9641807d6..d44de088b2 100644 --- a/activemq-web-console/src/main/webapp/topics.jsp +++ b/activemq-web-console/src/main/webapp/topics.jsp @@ -61,6 +61,8 @@
">Send To + + ">Active Producers
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 d4bf13ac08..c7e4d4a6f0 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 @@ -72,6 +72,28 @@ public interface BrokerFacade { Collection getQueueConsumers(String queueName) throws Exception; + /** + * All active producers to a queue. + * + * @param queueName + * the name of the queue, not null + * @return not null + * @throws Exception + */ + Collection getQueueProducers(String queueName) + throws Exception; + + /** + * All active producers to a topic. + * + * @param queueName + * the name of the topic, not null + * @return not null + * @throws Exception + */ + Collection getTopicProducers(String queueName) + throws Exception; + /** * Active durable subscribers to topics of the broker. * @@ -209,4 +231,4 @@ public interface BrokerFacade { boolean isJobSchedulerStarted(); -} \ No newline at end of file +} 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 babd8925f7..aa2006ad1b 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; @@ -216,6 +217,28 @@ public abstract class BrokerFacadeSupport implements BrokerFacade { return getManagedObjects(queryResult.toArray(new ObjectName[queryResult.size()]), SubscriptionViewMBean.class); } + @Override + @SuppressWarnings("unchecked") + public Collection 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 queryResult = queryNames(query, null); + return getManagedObjects(queryResult.toArray(new ObjectName[queryResult.size()]), ProducerViewMBean.class); + } + + @Override + @SuppressWarnings("unchecked") + public Collection 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 queryResult = queryNames(query, null); + return getManagedObjects(queryResult.toArray(new ObjectName[queryResult.size()]), ProducerViewMBean.class); + } + @Override @SuppressWarnings("unchecked") public Collection getConsumersOnConnection(String connectionName) throws Exception { 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 0000000000..b5ca8c9dc2 --- /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 getProducers() throws Exception { + return getBrokerFacade().getQueueProducers(getJMSDestination()); + } + + public void destroy() { + // empty + } + +} 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 0000000000..e645c27e5b --- /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 getProducers() throws Exception { + return getBrokerFacade().getTopicProducers(getJMSDestination()); + } + + public void destroy() { + // empty + } + +}