You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2014/01/30 15:51:57 UTC

git commit: Fixes AMQ-5002: Support receiving AMQP messages which do not have the timestamp set but the expiration is set.

Updated Branches:
  refs/heads/trunk e0e14e087 -> 875822de5


Fixes AMQ-5002: Support receiving AMQP messages which do not have the timestamp set but the expiration is set.


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/875822de
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/875822de
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/875822de

Branch: refs/heads/trunk
Commit: 875822de5172607496e7bd219a177213df92b7cd
Parents: e0e14e0
Author: Hiram Chirino <hi...@hiramchirino.com>
Authored: Thu Jan 30 09:51:41 2014 -0500
Committer: Hiram Chirino <hi...@hiramchirino.com>
Committed: Thu Jan 30 09:51:53 2014 -0500

----------------------------------------------------------------------
 .../activemq/transport/amqp/AmqpProtocolConverter.java    | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/875822de/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
index 1e43cba..62a05b9 100644
--- a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
+++ b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
@@ -566,6 +566,16 @@ class AmqpProtocolConverter implements IAmqpProtocolConverter {
                 message.setTransactionId(new LocalTransactionId(connectionId, txid));
             }
 
+            // Lets handle the case where the expiration was set, but the timestamp
+            // was not set by the client.  Lets assign the timestamp now, and adjust the
+            // expiration.
+            if( message.getExpiration()!= 0 ) {
+                if( message.getTimestamp()==0 ) {
+                    message.setTimestamp(System.currentTimeMillis());
+                    message.setExpiration(message.getTimestamp()+message.getExpiration());
+                }
+            }
+
             message.onSend();
             sendToActiveMQ(message, new ResponseHandler() {
                 @Override