AMQ-7499 add pause/resume operation of a queue in web console

This commit is contained in:
Philipp Daniels 2020-06-19 10:47:35 +02:00
parent 8cc5386fbb
commit 071edf522e
4 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,49 @@
/**
* 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.web.BrokerFacade;
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;
/**
*
*
*/
public class PauseDestination extends DestinationFacade implements Controller {
public PauseDestination(BrokerFacade brokerFacade) {
super(brokerFacade);
}
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
pauseDestination();
return redirectToBrowseView();
}
public void pauseDestination() throws Exception {
if (isQueue()) {
getQueueView().pause();
} else {
throw new UnsupportedOperationException("Pause supported for queues only. Receieved JMSDestinationType=" + getJMSDestinationType());
}
}
}

View File

@ -0,0 +1,49 @@
/**
* 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.web.BrokerFacade;
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;
/**
*
*
*/
public class ResumeDestination extends DestinationFacade implements Controller {
public ResumeDestination(BrokerFacade brokerFacade) {
super(brokerFacade);
}
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
resumeDestination();
return redirectToBrowseView();
}
public void resumeDestination() throws Exception {
if (isQueue()) {
getQueueView().resume();
} else {
throw new UnsupportedOperationException("Resume supported for queues only. Receieved JMSDestinationType=" + getJMSDestinationType());
}
}
}

View File

@ -40,6 +40,8 @@
<bean name="/moveMessage.action" class="org.apache.activemq.web.controller.MoveMessage" autowire="constructor" scope="prototype"/>
<bean name="/deleteJob.action" class="org.apache.activemq.web.controller.DeleteJob" autowire="constructor" scope="prototype"/>
<bean name="/retryMessage.action" class="org.apache.activemq.web.controller.RetryMessage" autowire="constructor" scope="prototype"/>
<bean name="/pauseDestination.action" class="org.apache.activemq.web.controller.PauseDestination" autowire="constructor" scope="prototype"/>
<bean name="/resumeDestination.action" class="org.apache.activemq.web.controller.ResumeDestination" autowire="constructor" scope="prototype"/>
<!--
- This bean resolves specific types of exception to corresponding error views.

View File

@ -101,6 +101,20 @@
<c:param name="JMSDestination" value="${row.name}" />
<c:param name="JMSDestinationType" value="queue" />
<c:param name="secret" value='${sessionScope["secret"]}'/></c:url>">Delete</a>
<c:choose>
<c:when test="${row.isPaused()}">
<a href="<c:url value="resumeDestination.action">
<c:param name="JMSDestination" value="${row.name}" />
<c:param name="JMSDestinationType" value="queue" />
<c:param name="secret" value='${sessionScope["secret"]}'/></c:url>">Resume</a>
</c:when>
<c:otherwise>
<a href="<c:url value="pauseDestination.action">
<c:param name="JMSDestination" value="${row.name}" />
<c:param name="JMSDestinationType" value="queue" />
<c:param name="secret" value='${sessionScope["secret"]}'/></c:url>">Pause</a>
</c:otherwise>
</c:choose>
</td>
</tr>