You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cs...@apache.org on 2016/03/15 13:04:53 UTC

[1/2] activemq git commit: AMQ-5662 improve Web Console to support retry from all configured DLQs

Repository: activemq
Updated Branches:
  refs/heads/master 8a44c08b1 -> 37557e5dc


AMQ-5662 improve Web Console to support retry from all configured DLQs


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/478d28f9
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/478d28f9
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/478d28f9

Branch: refs/heads/master
Commit: 478d28f988ab33fabddc06a1d841ef5dd7786947
Parents: b39ab78
Author: Petter Nordlander <pe...@fourmation.se>
Authored: Mon Mar 14 21:26:21 2016 +0100
Committer: Petter Nordlander <pe...@fourmation.se>
Committed: Mon Mar 14 21:26:21 2016 +0100

----------------------------------------------------------------------
 .../activemq/web/controller/RetryMessage.java   | 62 ++++++++++++++++++++
 .../main/webapp/WEB-INF/dispatcher-servlet.xml  |  1 +
 .../src/main/webapp/message.jsp                 | 33 ++++-------
 .../org/apache/activemq/web/MessageQuery.java   |  4 ++
 4 files changed, 79 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/478d28f9/activemq-web-console/src/main/java/org/apache/activemq/web/controller/RetryMessage.java
----------------------------------------------------------------------
diff --git a/activemq-web-console/src/main/java/org/apache/activemq/web/controller/RetryMessage.java b/activemq-web-console/src/main/java/org/apache/activemq/web/controller/RetryMessage.java
new file mode 100644
index 0000000..8610d20
--- /dev/null
+++ b/activemq-web-console/src/main/java/org/apache/activemq/web/controller/RetryMessage.java
@@ -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;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/478d28f9/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml
----------------------------------------------------------------------
diff --git a/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml b/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml
index 5aa4951..513e4b9 100644
--- a/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml
+++ b/activemq-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml
@@ -39,6 +39,7 @@
   <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="/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.

http://git-wip-us.apache.org/repos/asf/activemq/blob/478d28f9/activemq-web-console/src/main/webapp/message.jsp
----------------------------------------------------------------------
diff --git a/activemq-web-console/src/main/webapp/message.jsp b/activemq-web-console/src/main/webapp/message.jsp
index 40b78f7..4ca3bc1 100644
--- a/activemq-web-console/src/main/webapp/message.jsp
+++ b/activemq-web-console/src/main/webapp/message.jsp
@@ -134,28 +134,19 @@ No message could be found for ID <c:out value="${requestContext.messageQuery.id}
                     <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>
                     </tr>
-                    <c:set var="queueName" value="${requestContext.messageQuery.JMSDestination}"/>
-                    <c:set var="queueNameSubStr" value="${fn:substring(queueName, 0, 4)}" />
-                    <c:if test="${queueNameSubStr eq 'DLQ.' || queueNameSubStr eq 'DLT.'}">
-                        <c:if test="${queueNameSubStr eq 'DLQ.'}">
-                            <c:set var="moveToQueue" value="${fn:replace(queueName, 'DLQ.', '')}" />
-                        </c:if>
-                        <c:if test="${queueNameSubStr eq 'DLT.'}">
-                            <c:set var="moveToQueue" value="${fn:replace(queueName, 'DLT.', '')}" />
-                        </c:if>
-                        <tr>
-                            <td colspan="2">
-                                <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>
+                    <c:if test="${requestContext.messageQuery.isDLQ() || requestContext.messageQuery.JMSDestination eq 'ActiveMQ.DLQ'}">
+                    	<tr>
+                    		<td>
+                    	 		<a href="<c:url value="retryMessage.action">
+                                          <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?')"
+                                     title="Retry - attempt reprocessing on original destination">Retry</a>
                             </td>
-                        </tr>
+                       </tr>
                     </c:if>
                     <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>

http://git-wip-us.apache.org/repos/asf/activemq/blob/478d28f9/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java
----------------------------------------------------------------------
diff --git a/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java b/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java
index e416e52..79fab49 100644
--- a/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java
+++ b/activemq-web/src/main/java/org/apache/activemq/web/MessageQuery.java
@@ -111,6 +111,10 @@ public class MessageQuery extends QueueBrowseQuery {
 
         return null;
     }
+    
+    public boolean isDLQ() throws Exception {
+    	return getQueueView().isDLQ();
+    }
 
     public Map<String, Object> getPropertiesMap() throws JMSException {
         Map<String, Object> answer = new HashMap<String, Object>();


[2/2] activemq git commit: https://issues.apache.org/jira/browse/AMQ-5662

Posted by cs...@apache.org.
https://issues.apache.org/jira/browse/AMQ-5662

Patch applied with thanks to Petter Nordlander

This closes #176


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/37557e5d
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/37557e5d
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/37557e5d

Branch: refs/heads/master
Commit: 37557e5dcf838bab05851d6b46bbe10456473f3c
Parents: 8a44c08 478d28f
Author: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Authored: Tue Mar 15 11:48:16 2016 +0000
Committer: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Committed: Tue Mar 15 11:48:16 2016 +0000

----------------------------------------------------------------------
 .../activemq/web/controller/RetryMessage.java   | 62 ++++++++++++++++++++
 .../main/webapp/WEB-INF/dispatcher-servlet.xml  |  1 +
 .../src/main/webapp/message.jsp                 | 33 ++++-------
 .../org/apache/activemq/web/MessageQuery.java   |  4 ++
 4 files changed, 79 insertions(+), 21 deletions(-)
----------------------------------------------------------------------