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