From 5529bf150a7b3ac2e1cae7a883ad78ce27f0fe30 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 3 Apr 2017 08:22:51 +0100 Subject: [PATCH 1/2] ARTEMIS-1090 - Message not expired if absolute expiry time is 0 and ttl is set https://issues.apache.org/jira/browse/ARTEMIS-1090 --- .../protocol/amqp/broker/AMQPMessage.java | 2 +- .../amqp/AmqpExpiredMessageTest.java | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java index d2a91dfb80..affe49ad47 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java @@ -402,7 +402,7 @@ public class AMQPMessage extends RefCountMessage { if (section instanceof Properties) { _properties = (Properties) section; - if (_properties.getAbsoluteExpiryTime() != null) { + if (_properties.getAbsoluteExpiryTime() != null && _properties.getAbsoluteExpiryTime().getTime() > 0) { this.expiration = _properties.getAbsoluteExpiryTime().getTime(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpExpiredMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpExpiredMessageTest.java index c075be1dfc..047d88d2ce 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpExpiredMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpExpiredMessageTest.java @@ -124,6 +124,41 @@ public class AmqpExpiredMessageTest extends AmqpClientTestSupport { connection.close(); } + @Test(timeout = 60000) + public void testSendMessageThatIsExpiredUsingTTLWhenAbsoluteIsZero() throws Exception { + AmqpClient client = createAmqpClient(); + AmqpConnection connection = addConnection(client.connect()); + AmqpSession session = connection.createSession(); + + AmqpSender sender = session.createSender(getTestName()); + + // Get the Queue View early to avoid racing the delivery. + final Queue queueView = getProxyToQueue(getTestName()); + assertNotNull(queueView); + + AmqpMessage message = new AmqpMessage(); + message.setAbsoluteExpiryTime(0); + // AET should override any TTL set + message.setTimeToLive(1000); + message.setText("Test-Message"); + sender.send(message); + sender.close(); + + assertEquals(1, queueView.getMessageCount()); + + Thread.sleep(1000); + + // Now try and get the message + AmqpReceiver receiver = session.createReceiver(getTestName()); + receiver.flow(1); + AmqpMessage received = receiver.receive(1, TimeUnit.SECONDS); + assertNull(received); + + assertEquals(1, queueView.getMessagesExpired()); + + connection.close(); + } + @Test(timeout = 60000) public void testSendMessageThatIsNotExpiredUsingAbsoluteTimeWithElspsedTTL() throws Exception { AmqpClient client = createAmqpClient(); From 8b9cb2181c1e785af794500b61875cbd3e644281 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 3 Apr 2017 08:55:39 +0100 Subject: [PATCH 2/2] update jolokia war to remove version in binary --- .../artemis/cli/commands/etc/bootstrap-web-settings.txt | 2 +- artemis-distribution/src/main/assembly/dep.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap-web-settings.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap-web-settings.txt index c4d83c8f6b..173a708a24 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap-web-settings.txt +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap-web-settings.txt @@ -1,4 +1,4 @@ - + diff --git a/artemis-distribution/src/main/assembly/dep.xml b/artemis-distribution/src/main/assembly/dep.xml index 92c984cce6..8e3dd93984 100644 --- a/artemis-distribution/src/main/assembly/dep.xml +++ b/artemis-distribution/src/main/assembly/dep.xml @@ -139,6 +139,7 @@ web false + jolokia.war