Reworking DurableConduitBridge to look up subscriptions from the
TopicRegion  instead of the RegionBroker since inactive subscriptions
need to be looked at as well when dynamicOnly is false for a
network bridge.
This commit is contained in:
Christopher L. Shannon (cshannon) 2015-07-28 17:44:53 +00:00 committed by gtully
parent eb8723c1e9
commit 5684d093c0
2 changed files with 11 additions and 1 deletions

View File

@ -424,4 +424,8 @@ public class TopicRegion extends AbstractRegion {
public DurableTopicSubscription getDurableSubscription(SubscriptionKey key) {
return durableSubscriptions.get(key);
}
public Map<SubscriptionKey, DurableTopicSubscription> getDurableSubscriptions() {
return durableSubscriptions;
}
}

View File

@ -18,7 +18,9 @@ package org.apache.activemq.network;
import java.io.IOException;
import org.apache.activemq.broker.region.RegionBroker;
import org.apache.activemq.broker.region.Subscription;
import org.apache.activemq.broker.region.TopicRegion;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ConsumerId;
import org.apache.activemq.command.ConsumerInfo;
@ -64,11 +66,15 @@ public class DurableConduitBridge extends ConduitBridge {
try {
//Filtering by non-empty subscriptions, see AMQ-5875
if (dest.isTopic()) {
RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker();
TopicRegion topicRegion = (TopicRegion) regionBroker.getTopicRegion();
String candidateSubName = getSubscriberName(dest);
for (Subscription subscription : this.getRegionSubscriptions(dest)) {
for (Subscription subscription : topicRegion.getDurableSubscriptions().values()) {
String subName = subscription.getConsumerInfo().getSubscriptionName();
if (subName != null && subName.equals(candidateSubName)) {
DemandSubscription sub = createDemandSubscription(dest);
sub.getLocalInfo().setSubscriptionName(getSubscriberName(dest));
sub.setStaticallyIncluded(true);
addSubscription(sub);
break;