qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject svn commit: r1531761 - in /qpid/trunk/qpid/java: client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java common/src/main/java/org/apache/qpid/configuration/ClientProperties.java
Date Sun, 13 Oct 2013 22:21:59 GMT
Author: robbie
Date: Sun Oct 13 22:21:59 2013
New Revision: 1531761

URL: http://svn.apache.org/r1531761
Log:
QPID-5223: add system property to toggle populating the 'expiration' header with the raw TTL
value instead of the actual expiration time, for interop with e.g. RabbitMQ

Modified:
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java
    qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java?rev=1531761&r1=1531760&r2=1531761&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java
(original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java
Sun Oct 13 22:21:59 2013
@@ -24,6 +24,7 @@ import org.apache.qpid.AMQException;
 import org.apache.qpid.client.message.AMQMessageDelegate_0_8;
 import org.apache.qpid.client.message.AbstractJMSMessage;
 import org.apache.qpid.client.protocol.AMQProtocolHandler;
+import org.apache.qpid.configuration.ClientProperties;
 import org.apache.qpid.framing.AMQFrame;
 import org.apache.qpid.framing.BasicContentHeaderProperties;
 import org.apache.qpid.framing.BasicPublishBody;
@@ -32,7 +33,6 @@ import org.apache.qpid.framing.ContentBo
 import org.apache.qpid.framing.ContentHeaderBody;
 import org.apache.qpid.framing.ExchangeDeclareBody;
 import org.apache.qpid.framing.MethodRegistry;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -40,12 +40,14 @@ import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.Queue;
 import javax.jms.Topic;
+
 import java.nio.ByteBuffer;
 import java.util.UUID;
 
 public class BasicMessageProducer_0_8 extends BasicMessageProducer
 {
-	private static final Logger _logger = LoggerFactory.getLogger(BasicMessageProducer_0_8.class);
+    private static final Logger _logger = LoggerFactory.getLogger(BasicMessageProducer_0_8.class);
+    private static final boolean SET_EXPIRATION_AS_TTL = Boolean.getBoolean(ClientProperties.SET_EXPIRATION_AS_TTL);
 
     BasicMessageProducer_0_8(AMQConnection connection, AMQDestination destination, boolean
transacted, int channelId,
             AMQSession session, AMQProtocolHandler protocolHandler, long producerId, Boolean
immediate, Boolean mandatory) throws AMQException
@@ -118,7 +120,16 @@ public class BasicMessageProducer_0_8 ex
 
             if (timeToLive > 0)
             {
-                contentHeaderProperties.setExpiration(currentTime + timeToLive);
+                if(!SET_EXPIRATION_AS_TTL)
+                {
+                    //default behaviour used by Qpid
+                    contentHeaderProperties.setExpiration(currentTime + timeToLive);
+                }
+                else
+                {
+                    //alternative behaviour for brokers interpreting the expiration header
directly as a TTL.
+                    contentHeaderProperties.setExpiration(timeToLive);
+                }
             }
             else
             {

Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java?rev=1531761&r1=1531760&r2=1531761&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java
(original)
+++ qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/configuration/ClientProperties.java
Sun Oct 13 22:21:59 2013
@@ -208,6 +208,13 @@ public class ClientProperties
     public static final String QPID_MAX_CACHED_ADDR_OPTION_STRINGS = "qpid.max_cached_address_option_strings";
     public static final int DEFAULT_MAX_CACHED_ADDR_OPTION_STRINGS = 10;
 
+    /**
+     * System property to control whether the 0-8/0-9/0-9-1 client will set the message
+     * 'expiration' header using the computed expiration value (default, when false) or instead
set
+     * it to the raw TTL (when true). May be necessary for interop with other vendors.
+     */
+    public static final String SET_EXPIRATION_AS_TTL = "qpid.set_expiration_as_ttl";
+
     private ClientProperties()
     {
         //No instances



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message