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 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();