mirror of https://github.com/apache/activemq.git
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:
parent
eb8723c1e9
commit
5684d093c0
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue