mirror of https://github.com/apache/activemq.git
AMQ-5662 improve Web Console to support retry from all configured DLQs
This commit is contained in:
parent
b39ab7867c
commit
478d28f988
|
@ -0,0 +1,62 @@
|
||||||
|
/**
|
||||||
|
* 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.jmx.QueueViewMBean;
|
||||||
|
import org.apache.activemq.web.BrokerFacade;
|
||||||
|
import org.apache.activemq.web.DestinationFacade;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import org.springframework.web.servlet.mvc.Controller;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retry a message on a queue.
|
||||||
|
*/
|
||||||
|
public class RetryMessage extends DestinationFacade implements Controller {
|
||||||
|
private String messageId;
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(MoveMessage.class);
|
||||||
|
|
||||||
|
public RetryMessage(BrokerFacade brokerFacade) {
|
||||||
|
super(brokerFacade);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
if (messageId != null) {
|
||||||
|
QueueViewMBean queueView = getQueueView();
|
||||||
|
if (queueView != null) {
|
||||||
|
log.info("Retrying message " + getJMSDestination() + "(" + messageId + ")");
|
||||||
|
queueView.retryMessage(messageId);
|
||||||
|
} else {
|
||||||
|
log.warn("No queue named: " + getPhysicalDestinationName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return redirectToDestinationView();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessageId() {
|
||||||
|
return messageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageId(String messageId) {
|
||||||
|
this.messageId = messageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -39,6 +39,7 @@
|
||||||
<bean name="/copyMessage.action" class="org.apache.activemq.web.controller.CopyMessage" autowire="constructor" scope="prototype"/>
|
<bean name="/copyMessage.action" class="org.apache.activemq.web.controller.CopyMessage" autowire="constructor" scope="prototype"/>
|
||||||
<bean name="/moveMessage.action" class="org.apache.activemq.web.controller.MoveMessage" autowire="constructor" scope="prototype"/>
|
<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="/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"/>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
- This bean resolves specific types of exception to corresponding error views.
|
- This bean resolves specific types of exception to corresponding error views.
|
||||||
|
|
|
@ -134,28 +134,19 @@ No message could be found for ID <c:out value="${requestContext.messageQuery.id}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><a href="<c:out value='deleteMessage.action?JMSDestination=${requestContext.messageQuery.JMSDestination}&messageId=${row.JMSMessageID}&secret=${sessionScope["secret"]}' />" onclick="return confirm('Are you sure you want to delete the message?')" >Delete</a></td>
|
<td colspan="2"><a href="<c:out value='deleteMessage.action?JMSDestination=${requestContext.messageQuery.JMSDestination}&messageId=${row.JMSMessageID}&secret=${sessionScope["secret"]}' />" onclick="return confirm('Are you sure you want to delete the message?')" >Delete</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<c:set var="queueName" value="${requestContext.messageQuery.JMSDestination}"/>
|
<c:if test="${requestContext.messageQuery.isDLQ() || requestContext.messageQuery.JMSDestination eq 'ActiveMQ.DLQ'}">
|
||||||
<c:set var="queueNameSubStr" value="${fn:substring(queueName, 0, 4)}" />
|
<tr>
|
||||||
<c:if test="${queueNameSubStr eq 'DLQ.' || queueNameSubStr eq 'DLT.'}">
|
<td>
|
||||||
<c:if test="${queueNameSubStr eq 'DLQ.'}">
|
<a href="<c:url value="retryMessage.action">
|
||||||
<c:set var="moveToQueue" value="${fn:replace(queueName, 'DLQ.', '')}" />
|
<c:param name="JMSDestination" value="${requestContext.messageQuery.JMSDestination}" />
|
||||||
</c:if>
|
<c:param name="messageId" value="${row.JMSMessageID}" />
|
||||||
<c:if test="${queueNameSubStr eq 'DLT.'}">
|
<c:param name="JMSDestinationType" value="queue" />
|
||||||
<c:set var="moveToQueue" value="${fn:replace(queueName, 'DLT.', '')}" />
|
<c:param name="secret" value='${sessionScope["secret"]}' />
|
||||||
</c:if>
|
</c:url>"
|
||||||
<tr>
|
onclick="return confirm('Are you sure you want to retry this message?')"
|
||||||
<td colspan="2">
|
title="Retry - attempt reprocessing on original destination">Retry</a>
|
||||||
<a href="<c:url value="moveMessage.action">
|
|
||||||
<c:param name="destination" value="${moveToQueue}" />
|
|
||||||
<c:param name="JMSDestination" value="${requestContext.messageQuery.JMSDestination}" />
|
|
||||||
<c:param name="messageId" value="${row.JMSMessageID}" />
|
|
||||||
<c:param name="JMSDestinationType" value="queue" />
|
|
||||||
<c:param name="secret" value='${sessionScope["secret"]}' />
|
|
||||||
</c:url>"
|
|
||||||
onclick="return confirm('Are you sure you want to retry this message on queue://<c:out value="${moveToQueue}"/>?')"
|
|
||||||
title="Move to <c:out value="$moveToQueue" /> to attempt reprocessing">Retry</a>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:if>
|
</c:if>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td><a href="<c:out value="javascript:confirmAction('queue', 'copyMessage.action?destination=%target%&JMSDestination=${requestContext.messageQuery.JMSDestination}&messageId=${row.JMSMessageID}&JMSDestinationType=queue&secret=${sessionScope['secret']}"/>')">Copy</a></td>
|
<td><a href="<c:out value="javascript:confirmAction('queue', 'copyMessage.action?destination=%target%&JMSDestination=${requestContext.messageQuery.JMSDestination}&messageId=${row.JMSMessageID}&JMSDestinationType=queue&secret=${sessionScope['secret']}"/>')">Copy</a></td>
|
||||||
|
|
|
@ -111,6 +111,10 @@ public class MessageQuery extends QueueBrowseQuery {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDLQ() throws Exception {
|
||||||
|
return getQueueView().isDLQ();
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, Object> getPropertiesMap() throws JMSException {
|
public Map<String, Object> getPropertiesMap() throws JMSException {
|
||||||
Map<String, Object> answer = new HashMap<String, Object>();
|
Map<String, Object> answer = new HashMap<String, Object>();
|
||||||
|
|
Loading…
Reference in New Issue