/**
* 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) {
rc = rc.copy();
rc.getMessage().setRedeliveryCounter(0);
ActiveMQDestination originalDestination = rc.getOriginalDestination();
if (originalDestination != null) {
ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
return queue.moveMessageTo(context, rc, originalDestination);
}
else {
throw new JMSException("No original destination for message: "+ messageId);
}
}