From a439a0c6bf693e3fd68dcb190d22187c53ec8e9f Mon Sep 17 00:00:00 2001 From: gtully Date: Fri, 17 Jul 2015 16:56:22 +0100 Subject: [PATCH] AMQ-5875 - rework the patch a bit to only call createDemandSubscription when we have a match to avoid trcking state in error via the bridge subscriptionMap* from configureDemandSubscription --- .../activemq/network/DurableConduitBridge.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/DurableConduitBridge.java b/activemq-broker/src/main/java/org/apache/activemq/network/DurableConduitBridge.java index afcb42dedc..b4d04f6b0b 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/network/DurableConduitBridge.java +++ b/activemq-broker/src/main/java/org/apache/activemq/network/DurableConduitBridge.java @@ -61,23 +61,19 @@ public class DurableConduitBridge extends ConduitBridge { if (dests != null) { for (ActiveMQDestination dest : dests) { if (isPermissableDestination(dest) && !doesConsumerExist(dest)) { - DemandSubscription sub = createDemandSubscription(dest); - sub.setStaticallyIncluded(true); try { //Filtering by non-empty subscriptions, see AMQ-5875 if (dest.isTopic()) { - sub.getLocalInfo().setSubscriptionName(getSubscriberName(dest)); + String candidateSubName = getSubscriberName(dest); for (Subscription subscription : this.getRegionSubscriptions(dest)) { - String clientId = subscription.getContext().getClientId(); String subName = subscription.getConsumerInfo().getSubscriptionName(); - if (clientId != null && clientId.equals(sub.getLocalInfo().getClientId()) - && subName != null && subName.equals(sub.getLocalInfo().getSubscriptionName())) { + if (subName != null && subName.equals(candidateSubName)) { + DemandSubscription sub = createDemandSubscription(dest); + sub.setStaticallyIncluded(true); addSubscription(sub); break; } } - } else { - addSubscription(sub); } } catch (IOException e) { LOG.error("Failed to add static destination {}", dest, e);