added patch for AMQ-1908

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@688118 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2008-08-22 16:55:45 +00:00
parent dd64c8bc8e
commit 323bb2309e
2 changed files with 21 additions and 1 deletions

View File

@ -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;

View File

@ -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();
}