activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r618655 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java
Date Tue, 05 Feb 2008 14:05:47 GMT
Author: rajdavies
Date: Tue Feb  5 06:05:46 2008
New Revision: 618655

URL: http://svn.apache.org/viewvc?rev=618655&view=rev
Log:
copy message before resend

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java?rev=618655&r1=618654&r2=618655&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java
Tue Feb  5 06:05:46 2008
@@ -23,6 +23,10 @@
 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 @@
     
     /**
      * @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();



Mime
View raw message