private boolean matches(Subscription candidate, ConsumerInfo info) { boolean matched = false; for (ConsumerId candidateId: candidate.getConsumerInfo().getNetworkConsumerIds()) { for (ConsumerId subId: info.getNetworkConsumerIds()) { if (candidateId.equals(subId)) { matched = true; break; } } } return matched; }
LOG.debug("ignoring lower priority: {} [{}, {}] in favour of: {} [{}, {}]", new Object[]{ candidate, candidate.getConsumerInfo().getNetworkConsumerIds(), candidate.getConsumerInfo().getNetworkConsumerIds(), sub, sub.getConsumerInfo().getNetworkConsumerIds(), sub.getConsumerInfo().getNetworkConsumerIds() });
private boolean hasLowerPriority(Subscription existingSub, ConsumerInfo candidateInfo) { boolean suppress = false; if (existingSub.getConsumerInfo().getPriority() >= candidateInfo.getPriority()) { LOG.debug("{} Ignoring duplicate subscription from {}, sub: {} is duplicate by network subscription with equal or higher network priority: {}, networkConsumerIds: {}", new Object[]{ configuration.getBrokerName(), remoteBrokerName, candidateInfo, existingSub, existingSub.getConsumerInfo().getNetworkConsumerIds() }); suppress = true; } else { // remove the existing lower priority duplicate and allow this candidate try { removeDuplicateSubscription(existingSub); LOG.debug("{} Replacing duplicate subscription {} with sub from {}, which has a higher priority, new sub: {}, networkConsumerIds: {}", new Object[]{ configuration.getBrokerName(), existingSub.getConsumerInfo(), remoteBrokerName, candidateInfo, candidateInfo.getNetworkConsumerIds() }); } catch (IOException e) { LOG.error("Failed to remove duplicated sub as a result of sub with higher priority, sub: {}", existingSub, e); } } return suppress; }
if (!nc.isNetworkConsumersEmpty()) { for (ConsumerId id : nc.getNetworkConsumerIds()) {
private boolean duplicateSuppressionIsRequired(DemandSubscription candidate) { final ConsumerInfo consumerInfo = candidate.getRemoteInfo(); boolean suppress = false; if (isDuplicateSuppressionOff(consumerInfo)) { return suppress; } List<ConsumerId> candidateConsumers = consumerInfo.getNetworkConsumerIds(); Collection<Subscription> currentSubs = getRegionSubscriptions(consumerInfo.getDestination()); for (Subscription sub : currentSubs) { List<ConsumerId> networkConsumers = sub.getConsumerInfo().getNetworkConsumerIds(); if (!networkConsumers.isEmpty()) { if (matchFound(candidateConsumers, networkConsumers)) { if (isInActiveDurableSub(sub)) { suppress = false; } else { suppress = hasLowerPriority(sub, candidate.getLocalInfo()); } break; } } } return suppress; }
if (canConduit(ds) && filter.matches(info.getDestination())) { LOG.debug("{} {} with ids {} matched (add interest) {}", new Object[]{ configuration.getBrokerName(), info, info.getNetworkConsumerIds(), ds });
private boolean matches(Subscription candidate, ConsumerInfo info) { boolean matched = false; for (ConsumerId candidateId: candidate.getConsumerInfo().getNetworkConsumerIds()) { for (ConsumerId subId: info.getNetworkConsumerIds()) { if (candidateId.equals(subId)) { matched = true; break; } } } return matched; }
private boolean matches(Subscription candidate, ConsumerInfo info) { boolean matched = false; for (ConsumerId candidateId: candidate.getConsumerInfo().getNetworkConsumerIds()) { for (ConsumerId subId: info.getNetworkConsumerIds()) { if (candidateId.equals(subId)) { matched = true; break; } } } return matched; }
private boolean matches(Subscription candidate, ConsumerInfo info) { boolean matched = false; for (ConsumerId candidateId: candidate.getConsumerInfo().getNetworkConsumerIds()) { for (ConsumerId subId: info.getNetworkConsumerIds()) { if (candidateId.equals(subId)) { matched = true; break; } } } return matched; }
private boolean matches(Subscription candidate, ConsumerInfo info) { boolean matched = false; for (ConsumerId candidateId: candidate.getConsumerInfo().getNetworkConsumerIds()) { for (ConsumerId subId: info.getNetworkConsumerIds()) { if (candidateId.equals(subId)) { matched = true; break; } } } return matched; }
private boolean hasLowerPriority(Subscription existingSub, ConsumerInfo candidateInfo) { boolean suppress = false; if (existingSub.getConsumerInfo().getPriority() >= candidateInfo.getPriority()) { LOG.debug("{} Ignoring duplicate subscription from {}, sub: {} is duplicate by network subscription with equal or higher network priority: {}, networkConsumerIds: {}", new Object[]{ configuration.getBrokerName(), remoteBrokerName, candidateInfo, existingSub, existingSub.getConsumerInfo().getNetworkConsumerIds() }); suppress = true; } else { // remove the existing lower priority duplicate and allow this candidate try { removeDuplicateSubscription(existingSub); LOG.debug("{} Replacing duplicate subscription {} with sub from {}, which has a higher priority, new sub: {}, networkConsumerIds: {}", new Object[]{ configuration.getBrokerName(), existingSub.getConsumerInfo(), remoteBrokerName, candidateInfo, candidateInfo.getNetworkConsumerIds() }); } catch (IOException e) { LOG.error("Failed to remove duplicated sub as a result of sub with higher priority, sub: {}", existingSub, e); } } return suppress; }
private boolean hasLowerPriority(Subscription existingSub, ConsumerInfo candidateInfo) { boolean suppress = false; if (existingSub.getConsumerInfo().getPriority() >= candidateInfo.getPriority()) { LOG.debug("{} Ignoring duplicate subscription from {}, sub: {} is duplicate by network subscription with equal or higher network priority: {}, networkConsumerIds: {}", new Object[]{ configuration.getBrokerName(), remoteBrokerName, candidateInfo, existingSub, existingSub.getConsumerInfo().getNetworkConsumerIds() }); suppress = true; } else { // remove the existing lower priority duplicate and allow this candidate try { removeDuplicateSubscription(existingSub); LOG.debug("{} Replacing duplicate subscription {} with sub from {}, which has a higher priority, new sub: {}, networkConsumerIds: {}", new Object[]{ configuration.getBrokerName(), existingSub.getConsumerInfo(), remoteBrokerName, candidateInfo, candidateInfo.getNetworkConsumerIds() }); } catch (IOException e) { LOG.error("Failed to remove duplicated sub as a result of sub with higher priority, sub: {}", existingSub, e); } } return suppress; }
private boolean hasLowerPriority(Subscription existingSub, ConsumerInfo candidateInfo) { boolean suppress = false; if (existingSub.getConsumerInfo().getPriority() >= candidateInfo.getPriority()) { LOG.debug("{} Ignoring duplicate subscription from {}, sub: {} is duplicate by network subscription with equal or higher network priority: {}, networkConsumerIds: {}", new Object[]{ configuration.getBrokerName(), remoteBrokerName, candidateInfo, existingSub, existingSub.getConsumerInfo().getNetworkConsumerIds() }); suppress = true; } else { // remove the existing lower priority duplicate and allow this candidate try { removeDuplicateSubscription(existingSub); LOG.debug("{} Replacing duplicate subscription {} with sub from {}, which has a higher priority, new sub: {}, networkConsumerIds: {}", new Object[]{ configuration.getBrokerName(), existingSub.getConsumerInfo(), remoteBrokerName, candidateInfo, candidateInfo.getNetworkConsumerIds() }); } catch (IOException e) { LOG.error("Failed to remove duplicated sub as a result of sub with higher priority, sub: {}", existingSub, e); } } return suppress; }
private boolean hasLowerPriority(Subscription existingSub, ConsumerInfo candidateInfo) { boolean suppress = false; if (existingSub.getConsumerInfo().getPriority() >= candidateInfo.getPriority()) { if (LOG.isDebugEnabled()) { LOG.debug(configuration.getBrokerName() + " Ignoring duplicate subscription from " + remoteBrokerName + ", sub: " + candidateInfo + " is duplicated by network subscription with equal or higher network priority: " + existingSub.getConsumerInfo() + ", networkComsumerIds: " + existingSub.getConsumerInfo().getNetworkConsumerIds()); } suppress = true; } else { // remove the existing lower priority duplicate and allow this candidate try { removeDuplicateSubscription(existingSub); if (LOG.isDebugEnabled()) { LOG.debug(configuration.getBrokerName() + " Replacing duplicate subscription " + existingSub.getConsumerInfo() + " with sub from " + remoteBrokerName + ", which has a higher priority, new sub: " + candidateInfo + ", networkComsumerIds: " + candidateInfo.getNetworkConsumerIds()); } } catch (IOException e) { LOG.error("Failed to remove duplicated sub as a result of sub with higher priority, sub: " + existingSub, e); } } return suppress; }
if (!nc.isNetworkConsumersEmpty()) { for (ConsumerId id : nc.getNetworkConsumerIds()) {
if (!nc.isNetworkConsumersEmpty()) { for (ConsumerId id : nc.getNetworkConsumerIds()) {
private boolean duplicateSuppressionIsRequired(DemandSubscription candidate) { final ConsumerInfo consumerInfo = candidate.getRemoteInfo(); boolean suppress = false; if (isDuplicateSuppressionOff(consumerInfo)) { return suppress; } List<ConsumerId> candidateConsumers = consumerInfo.getNetworkConsumerIds(); Collection<Subscription> currentSubs = getRegionSubscriptions(consumerInfo.getDestination()); for (Subscription sub : currentSubs) { List<ConsumerId> networkConsumers = sub.getConsumerInfo().getNetworkConsumerIds(); if (!networkConsumers.isEmpty()) { if (matchFound(candidateConsumers, networkConsumers)) { if (isInActiveDurableSub(sub)) { suppress = false; } else { suppress = hasLowerPriority(sub, candidate.getLocalInfo()); } break; } } } return suppress; }
private boolean duplicateSuppressionIsRequired(DemandSubscription candidate) { final ConsumerInfo consumerInfo = candidate.getRemoteInfo(); boolean suppress = false; if (isDuplicateSuppressionOff(consumerInfo)) { return suppress; } List<ConsumerId> candidateConsumers = consumerInfo.getNetworkConsumerIds(); Collection<Subscription> currentSubs = getRegionSubscriptions(consumerInfo.getDestination()); for (Subscription sub : currentSubs) { List<ConsumerId> networkConsumers = sub.getConsumerInfo().getNetworkConsumerIds(); if (!networkConsumers.isEmpty()) { if (matchFound(candidateConsumers, networkConsumers)) { if (isInActiveDurableSub(sub)) { suppress = false; } else { suppress = hasLowerPriority(sub, candidate.getLocalInfo()); } break; } } } return suppress; }
private boolean duplicateSuppressionIsRequired(DemandSubscription candidate) { final ConsumerInfo consumerInfo = candidate.getRemoteInfo(); boolean suppress = false; if (isDuplicateSuppressionOff(consumerInfo)) { return suppress; } List<ConsumerId> candidateConsumers = consumerInfo.getNetworkConsumerIds(); Collection<Subscription> currentSubs = getRegionSubscriptions(consumerInfo.getDestination()); for (Subscription sub : currentSubs) { List<ConsumerId> networkConsumers = sub.getConsumerInfo().getNetworkConsumerIds(); if (!networkConsumers.isEmpty()) { if (matchFound(candidateConsumers, networkConsumers)) { if (isInActiveDurableSub(sub)) { suppress = false; } else { suppress = hasLowerPriority(sub, candidate.getLocalInfo()); } break; } } } return suppress; }
private boolean duplicateSuppressionIsRequired(DemandSubscription candidate) { final ConsumerInfo consumerInfo = candidate.getRemoteInfo(); boolean suppress = false; if (consumerInfo.getDestination().isQueue() && !configuration.isSuppressDuplicateQueueSubscriptions() || consumerInfo.getDestination().isTopic() && !configuration.isSuppressDuplicateTopicSubscriptions()) { return suppress; } List<ConsumerId> candidateConsumers = consumerInfo.getNetworkConsumerIds(); Collection<Subscription> currentSubs = getRegionSubscriptions(consumerInfo.getDestination().isTopic()); for (Subscription sub : currentSubs) { List<ConsumerId> networkConsumers = sub.getConsumerInfo().getNetworkConsumerIds(); if (!networkConsumers.isEmpty()) { if (matchFound(candidateConsumers, networkConsumers)) { suppress = hasLowerPriority(sub, candidate.getLocalInfo()); break; } } } return suppress; }