From c128634fa638ef814a8ee69ac5fb810cc8057387 Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Tue, 5 Feb 2008 14:05:46 +0000 Subject: [PATCH] copy message before resend git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@618655 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/util/BrokerSupport.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java b/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java index 28813550d1..6a76b9abee 100644 --- a/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java @@ -23,6 +23,10 @@ import org.apache.activemq.command.Message; import org.apache.activemq.command.ProducerInfo; import org.apache.activemq.state.ProducerState; +/** + * Utility class for re-sending messages + * + */ public final class BrokerSupport { private BrokerSupport() { @@ -30,17 +34,14 @@ public final class BrokerSupport { /** * @param context - * @param message + * @param originalMessage * @param deadLetterDestination * @throws Exception */ - public static void resend(final ConnectionContext context, Message message, ActiveMQDestination deadLetterDestination) throws Exception { - if (message.getOriginalDestination() != null) { - message.setOriginalDestination(message.getDestination()); - } - if (message.getOriginalTransactionId() != null) { - message.setOriginalTransactionId(message.getTransactionId()); - } + public static void resend(final ConnectionContext context, Message originalMessage, ActiveMQDestination deadLetterDestination) throws Exception { + Message message = originalMessage.copy(); + message.setOriginalDestination(message.getDestination()); + message.setOriginalTransactionId(message.getTransactionId()); message.setDestination(deadLetterDestination); message.setTransactionId(null); boolean originalFlowControl = context.isProducerFlowControl();