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

This commit is contained in:
gtully 2015-07-17 16:56:22 +01:00
parent 2117768e0a
commit a439a0c6bf
1 changed files with 4 additions and 8 deletions

View File

@ -61,23 +61,19 @@ public class DurableConduitBridge extends ConduitBridge {
if (dests != null) { if (dests != null) {
for (ActiveMQDestination dest : dests) { for (ActiveMQDestination dest : dests) {
if (isPermissableDestination(dest) && !doesConsumerExist(dest)) { if (isPermissableDestination(dest) && !doesConsumerExist(dest)) {
DemandSubscription sub = createDemandSubscription(dest);
sub.setStaticallyIncluded(true);
try { try {
//Filtering by non-empty subscriptions, see AMQ-5875 //Filtering by non-empty subscriptions, see AMQ-5875
if (dest.isTopic()) { if (dest.isTopic()) {
sub.getLocalInfo().setSubscriptionName(getSubscriberName(dest)); String candidateSubName = getSubscriberName(dest);
for (Subscription subscription : this.getRegionSubscriptions(dest)) { for (Subscription subscription : this.getRegionSubscriptions(dest)) {
String clientId = subscription.getContext().getClientId();
String subName = subscription.getConsumerInfo().getSubscriptionName(); String subName = subscription.getConsumerInfo().getSubscriptionName();
if (clientId != null && clientId.equals(sub.getLocalInfo().getClientId()) if (subName != null && subName.equals(candidateSubName)) {
&& subName != null && subName.equals(sub.getLocalInfo().getSubscriptionName())) { DemandSubscription sub = createDemandSubscription(dest);
sub.setStaticallyIncluded(true);
addSubscription(sub); addSubscription(sub);
break; break;
} }
} }
} else {
addSubscription(sub);
} }
} catch (IOException e) { } catch (IOException e) {
LOG.error("Failed to add static destination {}", dest, e); LOG.error("Failed to add static destination {}", dest, e);