From 67fca940d433cce0c9aa14895af5e24887b16801 Mon Sep 17 00:00:00 2001 From: Stanislav Knot Date: Wed, 29 Nov 2017 10:56:42 +0100 Subject: [PATCH] ARTEMIS-1530 Fix expiry statistics --- .../activemq/artemis/core/server/impl/QueueImpl.java | 7 ++++++- .../artemis/tests/integration/server/ExpiryRunnerTest.java | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index 31a4869510..41f504fa29 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -2454,7 +2454,12 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { postOffice.route(copyMessage, tx, false, rejectDuplicate); - acknowledge(tx, ref); + if (expiry) { + acknowledge(tx, ref, AckReason.EXPIRED); + } else { + acknowledge(tx, ref); + } + } @SuppressWarnings({"ArrayToString", "ArrayToStringConcatenation"}) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ExpiryRunnerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ExpiryRunnerTest.java index fa04395ae4..74c9cff8b5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ExpiryRunnerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ExpiryRunnerTest.java @@ -163,6 +163,7 @@ public class ExpiryRunnerTest extends ActiveMQTestBase { Assert.assertNotNull(cm); // assertEquals("m" + i, cm.getBody().getString()); } + Assert.assertEquals(100, ((Queue) server.getPostOffice().getBinding(qName).getBindable()).getMessagesExpired()); consumer.close(); }