From 323bb2309e815224d76350f04667ab2789a5278d Mon Sep 17 00:00:00 2001 From: James Strachan Date: Fri, 22 Aug 2008 16:55:45 +0000 Subject: [PATCH] added patch for AMQ-1908 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@688118 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/broker/jmx/QueueView.java | 15 +++++++++++++++ .../activemq/broker/jmx/QueueViewMBean.java | 7 ++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueView.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueView.java index f3719a4d0c..8cb80ea2bc 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueView.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueView.java @@ -92,6 +92,21 @@ public class QueueView extends DestinationView implements QueueViewMBean { return ((Queue)destination).moveMatchingMessagesTo(context, selector, toDestination, maximumMessages); } + /** + * Moves a message back to its original destination + */ + public boolean retryMessage(String messageId) throws Exception { + Queue queue = (Queue) destination; + Message rc = queue.getMessage(messageId); + if (rc != null) { + ActiveMQDestination originalDestination = rc.getOriginalDestination(); + if (originalDestination != null) { + ConnectionContext context = BrokerView.getConnectionContext(broker.getContextBroker()); + return queue.moveMessageTo(context, messageId, originalDestination); + } + } + return false; + } public int cursorSize() { Queue queue = (Queue) destination; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java index d8965744d8..7616a75818 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java @@ -100,6 +100,11 @@ public interface QueueViewMBean extends DestinationViewMBean { */ boolean moveMessageTo(String messageId, String destinationName) throws Exception; + /** + * Moves a message back to its original destination + */ + boolean retryMessage(String messageId) throws Exception; + /** * Moves the messages matching the given selector * @@ -145,5 +150,5 @@ public interface QueueViewMBean extends DestinationViewMBean { * by the cursor */ public int cursorSize(); - + }