diff options
| author | Robert Gemmell <robbie@apache.org> | 2013-10-13 22:21:59 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2013-10-13 22:21:59 +0000 |
| commit | 3b9b2ece8af8767492c77ea0e3bbd71a36307ce7 (patch) | |
| tree | 5e76fca495e60f54a6ca473d329ccdeabe0a73cd /qpid/java/client | |
| parent | fe16af8023970c2291d9023abbaf6f1b92befaf5 (diff) | |
| download | qpid-python-3b9b2ece8af8767492c77ea0e3bbd71a36307ce7.tar.gz | |
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
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1531761 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client')
| -rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java index bb270b0878..3cb723e5a8 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java @@ -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.ContentBody; 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 extends BasicMessageProducer 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 { |
