/**
* Moves a message back to its original destination
*/
public boolean retryMessage(String messageId) throws Exception {
Queue queue = (Queue) destination;
QueueMessageReference ref = queue.getMessage(messageId);
Message rc = ref.getMessage();
if (rc != null) {
ActiveMQDestination originalDestination = rc.getOriginalDestination();
if (originalDestination != null) {
ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
return queue.moveMessageTo(context, ref, originalDestination);
}
else {
throw new JMSException("No original destination for message: "+ messageId);
}
}