From 52ba27a840a75a7afc2d4cae4fe5152e84e8f3b0 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Tue, 8 Mar 2011 16:06:39 +0000 Subject: QPID-2732 The reliability mode is now used on the producer side to determine replay. Any messages transfers sent to a destination marked unreliable will not be added to the replay buffer. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1079408 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/qpid/client/BasicMessageProducer_0_10.java | 7 ++++++- java/common/src/main/java/org/apache/qpid/transport/Session.java | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'java') diff --git a/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java b/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java index 55ec56a425..36f2dfb66f 100644 --- a/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java +++ b/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java @@ -19,6 +19,7 @@ package org.apache.qpid.client; import static org.apache.qpid.transport.Option.NONE; import static org.apache.qpid.transport.Option.SYNC; +import static org.apache.qpid.transport.Option.UNRELIABLE; import java.nio.ByteBuffer; import java.util.HashMap; @@ -34,6 +35,7 @@ import org.apache.qpid.client.AMQDestination.AddressOption; import org.apache.qpid.client.AMQDestination.DestSyntax; import org.apache.qpid.client.message.AMQMessageDelegate_0_10; import org.apache.qpid.client.message.AbstractJMSMessage; +import org.apache.qpid.client.messaging.address.Link.Reliability; import org.apache.qpid.client.messaging.address.Node.QueueNode; import org.apache.qpid.client.protocol.AMQProtocolHandler; import org.apache.qpid.transport.DeliveryProperties; @@ -212,6 +214,9 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer deliveryMode == DeliveryMode.PERSISTENT) ); + boolean unreliable = (destination.getDestSyntax() == DestSyntax.ADDR) && + (destination.getLink().getReliability() == Reliability.UNRELIABLE); + org.apache.mina.common.ByteBuffer data = message.getData(); ByteBuffer buffer = data == null ? ByteBuffer.allocate(0) : data.buf().slice(); @@ -219,7 +224,7 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED, new Header(deliveryProp, messageProps), - buffer, sync ? SYNC : NONE); + buffer, sync ? SYNC : NONE, unreliable ? UNRELIABLE : NONE); if (sync) { ssn.sync(); diff --git a/java/common/src/main/java/org/apache/qpid/transport/Session.java b/java/common/src/main/java/org/apache/qpid/transport/Session.java index 242c7f2b0d..d961507382 100644 --- a/java/common/src/main/java/org/apache/qpid/transport/Session.java +++ b/java/common/src/main/java/org/apache/qpid/transport/Session.java @@ -664,7 +664,12 @@ public class Session extends SessionInvoker { sessionCommandPoint(0, 0); } - if ((!closing && !transacted && m instanceof MessageTransfer) || m.hasCompletionListener()) + + boolean replayTransfer = !closing && !transacted && + m instanceof MessageTransfer && + ! m.isUnreliable(); + + if ((replayTransfer) || m.hasCompletionListener()) { commands[mod(next, commands.length)] = m; commandBytes += m.getBodySize(); -- cgit v1.2.1