From c4339d809bc199cd7d90eaa7589ea3c76f304929 Mon Sep 17 00:00:00 2001 From: Howard Gao Date: Mon, 5 Dec 2016 22:06:25 +0800 Subject: [PATCH] Fix JMSDurableTopicRedeliverTest.testRedeliverNewSession test failure --- .../artemis/core/protocol/openwire/amq/AMQConsumer.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java index 8b80bde9f7..7f4f2d108d 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java @@ -48,7 +48,6 @@ import org.apache.activemq.command.RemoveInfo; import org.apache.activemq.wireformat.WireFormat; public class AMQConsumer { - private AMQSession session; private org.apache.activemq.command.ActiveMQDestination openwireDestination; private ConsumerInfo info; @@ -319,6 +318,13 @@ public class AMQConsumer { long seqId = ref.getMessage().getMessageID(); long lastDelSeqId = info.getLastDeliveredSequenceId(); + //in activemq5, closing a durable subscription won't close the consumer + //at broker. Messages will be treated as if being redelivered to + //the same consumer. + if (this.info.isDurable() && this.getOpenwireDestination().isTopic()) { + return true; + } + //because delivering count is always one greater than redelivery count //we adjust it down before further calculating. ref.decrementDeliveryCount();