activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r948858 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java
Date Thu, 27 May 2010 15:22:45 GMT
Author: gtully
Date: Thu May 27 15:22:43 2010
New Revision: 948858

URL: http://svn.apache.org/viewvc?rev=948858&view=rev
Log:
resolve https://issues.apache.org/activemq/browse/AMQ-2752 - allow timestamp broker plugin
to optinally modify network messages, processNetworkMessages attribute

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

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java?rev=948858&r1=948857&r2=948858&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/TimeStampingBrokerPlugin.java
Thu May 27 15:22:43 2010
@@ -64,6 +64,13 @@ public class TimeStampingBrokerPlugin ex
      * False by default
      */
     boolean futureOnly = false;
+    
+    
+    /**
+     * if true, update timestamp even if message has passed through a network
+     * default false
+     */
+    boolean processNetworkMessages = false;
 
     /** 
     * setter method for zeroExpirationOverride
@@ -84,12 +91,16 @@ public class TimeStampingBrokerPlugin ex
 	public void setFutureOnly(boolean futureOnly) {
 		this.futureOnly = futureOnly;
 	}
+	
+	public void setProcessNetworkMessages(Boolean processNetworkMessages) {
+	    this.processNetworkMessages = processNetworkMessages;
+	}
 
 	@Override
     public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception
{
         if (message.getTimestamp() > 0
-            && (message.getBrokerPath() == null || message.getBrokerPath().length
== 0)) {
-            // timestamp not been disabled and has not passed through a network
+            && (processNetworkMessages || (message.getBrokerPath() == null || message.getBrokerPath().length
== 0))) {
+            // timestamp not been disabled and has not passed through a network or processNetworkMessages=true
             long oldExpiration = message.getExpiration();
             long newTimeStamp = System.currentTimeMillis();
             long timeToLive = zeroExpirationOverride;



Mime
View raw message