activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/3] activemq-artemis git commit: ENTMQBR-522 - dont ack on separately settled deliveries
Date Fri, 10 Feb 2017 14:55:13 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 42588fbac -> 152b929b5


ENTMQBR-522 - dont ack on separately settled deliveries

https://issues.jboss.org/browse/ENTMQBR-522


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

Branch: refs/heads/master
Commit: 318778954db744213d3a72d06cb91108542f1804
Parents: 42588fb
Author: Andy Taylor <andy.tayls67@gmail.com>
Authored: Fri Feb 10 11:27:54 2017 +0000
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Fri Feb 10 09:50:51 2017 -0500

----------------------------------------------------------------------
 .../amqp/proton/ProtonServerSenderContext.java  |  5 ++++
 .../transport/amqp/client/AmqpMessage.java      |  4 +++
 .../integration/amqp/AmqpSendReceiveTest.java   | 26 ++++++++++++++++++++
 3 files changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/31877895/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
index 938c6ca..41c996a 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
@@ -507,6 +507,11 @@ public class ProtonServerSenderContext extends ProtonInitializable implements
Pr
                }
             }
          } else if (remoteState instanceof Accepted) {
+            //this can happen in the twice ack mode, that is the receiver accepts and settles
separately
+            //acking again would show an exception but would have no negative effect but
best to handle anyway.
+            if (delivery.isSettled()) {
+               return;
+            }
             // we have to individual ack as we can't guarantee we will get the delivery updates
             // (including acks) in order
             // from dealer, a perf hit but a must

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/31877895/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java
----------------------------------------------------------------------
diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java
b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java
index bd89377..0c4250d 100644
--- a/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java
+++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/transport/amqp/client/AmqpMessage.java
@@ -627,4 +627,8 @@ public class AmqpMessage {
          message.setProperties(new Properties());
       }
    }
+
+   public void settle() {
+      delivery.settle();
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/31877895/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveTest.java
index b9d5504..dd98def 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveTest.java
@@ -75,6 +75,32 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
    }
 
    @Test(timeout = 60000)
+   public void testAcceptWithoutSettling() throws Exception {
+      AmqpClient client = createAmqpClient();
+      AmqpConnection connection = addConnection(client.connect());
+      AmqpSession session = connection.createSession();
+
+      AmqpReceiver receiver = session.createReceiver(getTestName());
+
+      sendMessages(getTestName(), 10);
+
+      for (int i = 0; i < 10; i++) {
+         receiver.flow(1);
+         AmqpMessage receive = receiver.receive();
+         receive.accept(false);
+         receive.settle();
+      }
+
+      receiver.close();
+      connection.close();
+
+      Queue queue = getProxyToQueue(getTestName());
+      assertNotNull(queue);
+      assertEquals(0, queue.getMessageCount());
+   }
+
+
+   @Test(timeout = 60000)
    public void testCreateQueueReceiverWithJMSSelector() throws Exception {
       AmqpClient client = createAmqpClient();
 


Mime
View raw message