- Fix some browsing problems in the web console.
- Added a purge queue action.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@473056 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2006-11-09 20:12:29 +00:00
parent 8be1b5eb5a
commit 0918fba384
4 changed files with 69 additions and 5 deletions

View File

@ -0,0 +1,59 @@
/**
*
* 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.controller;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.region.Queue;
import org.apache.activemq.web.DestinationFacade;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Set;
import java.util.Iterator;
/**
*
* @version $Revision$
*/
public class PurgeDestination extends DestinationFacade implements Controller {
public PurgeDestination(BrokerService brokerService) {
super(brokerService);
}
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
purgeDestination();
return redirectToBrowseView();
}
public void purgeDestination() throws Exception {
if (isQueue()) {
Set destinations = getManagedBroker().getQueueRegion().getDestinations(createDestination());
for (Iterator i=destinations.iterator(); i.hasNext();) {
Queue regionQueue = (Queue)i.next();
regionQueue.purge();
}
}
else {
throw new UnsupportedOperationException("Purge supported for queues only. Receieved JMSDestinationType=" + getJMSDestinationType());
}
}
}

View File

@ -31,6 +31,7 @@
<bean name="/createSubscriber.action" class="org.apache.activemq.web.controller.CreateSubscriber" autowire="constructor" singleton="false"/>
<bean name="/deleteSubscriber.action" class="org.apache.activemq.web.controller.DeleteSubscriber" autowire="constructor" singleton="false"/>
<bean name="/sendMessage.action" class="org.apache.activemq.web.controller.SendMessage" autowire="constructor" singleton="false"/>
<bean name="/purgeDestination.action" class="org.apache.activemq.web.controller.PurgeDestination" autowire="constructor" singleton="false"/>
<!--
- This bean resolves specific types of exception to corresponding error views.

View File

@ -54,10 +54,10 @@
<c:forEach items="${requestContext.brokerQuery.queues}" var="row">
<tr>
<td><a href="browse.jsp?JMSDestination=${row.name}">${row.name}</a></td>
<td>${row.queueSize}</td>
<td>${row.consumerCount}</td>
<td>${row.enqueueCount}</td>
<td>${row.dequeueCount}</td>
<td>${row.destinationStatistics.messages.count}</td>
<td>${row.destinationStatistics.consumers.count}</td>
<td>${row.destinationStatistics.enqueues.count}</td>
<td>${row.destinationStatistics.dequeues.count}</td>
<td>
<a href="browse.jsp?JMSDestination=${row.name}">Browse</a>
<%--

View File

@ -19,7 +19,11 @@
<c:forEach items="${requestContext.brokerQuery.queues}" var="row">
<queue name="${row.name}">
<stats size="${row.queueSize}" consumerCount="${row.consumerCount}" enqueueCount="${row.enqueueCount}" dequeueCount="${row.dequeueCount}"/>
<stats size="${row.destinationStatistics.messages.count}"
consumerCount="${row.destinationStatistics.consumers.count}"
enqueueCount="${row.destinationStatistics.enqueues.count}"
dequeueCount="${row.destinationStatistics.dequeues.count}"/>
<feed>
<atom><c:url value="queueBrowse/${row.name}?view=rss&amp;feedType=atom_1.0"/></atom>