reset redivery counter on retryMessage() - and speed it up a little -

for https://issues.apache.org/activemq/browse/AMQ-1909

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@691214 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-09-02 12:22:51 +00:00
parent d14e4aee1c
commit e8a74514da
2 changed files with 17 additions and 1 deletions

View File

@ -100,10 +100,12 @@ public class QueueView extends DestinationView implements QueueViewMBean {
Queue queue = (Queue) destination;
Message rc = queue.getMessage(messageId);
if (rc != null) {
rc = rc.copy();
rc.getMessage().setRedeliveryCounter(0);
ActiveMQDestination originalDestination = rc.getOriginalDestination();
if (originalDestination != null) {
ConnectionContext context = BrokerView.getConnectionContext(broker.getContextBroker());
return queue.moveMessageTo(context, messageId, originalDestination);
return queue.moveMessageTo(context, rc, originalDestination);
}
else {
throw new JMSException("No original destination for message: "+ messageId);

View File

@ -851,6 +851,20 @@ public class Queue extends BaseDestination implements Task {
return movedCounter;
}
/**
* Move a message
* @param context
* @param r
* @param dest
* @throws Exception
*/
public boolean moveMessageTo(ConnectionContext context,Message m,ActiveMQDestination dest) throws Exception {
QueueMessageReference r = createMessageReference(m);
BrokerSupport.resend(context, m, dest);
removeMessage(context, r);
return true;
}
/**
* Moves the message matching the given messageId
*/