@Override public DemandForwardingBridge createNetworkBridge(NetworkBridgeConfiguration configuration, Transport localTransport, Transport remoteTransport, NetworkBridgeListener listener) { if (configuration.isConduitSubscriptions()) { // dynamicOnly determines whether durables are auto bridged return attachListener(new DurableConduitBridge(configuration, localTransport, remoteTransport), listener); } return attachListener(new DemandForwardingBridge(configuration, localTransport, remoteTransport), listener); }
if (dests != null) { for (ActiveMQDestination dest : dests) { if (isPermissableDestination(dest) && !doesConsumerExist(dest)) { try { String candidateSubName = getSubscriberName(dest); for (Subscription subscription : topicRegion.getDurableSubscriptions().values()) { String subName = subscription.getConsumerInfo().getSubscriptionName(); String clientId = subscription.getContext().getClientId(); if (subName != null && subName.equals(candidateSubName) && clientId.startsWith(configuration.getName())) { DemandSubscription sub = createDemandSubscription(dest, subName); if (sub != null) { sub.getLocalInfo().setSubscriptionName(getSubscriberName(dest)); sub.setStaticallyIncluded(true); addSubscription(sub); break; } else if (configuration.isSyncDurableSubs() && !isPermissableDestination(dest)) { if (dest.isTopic()) { RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker(); TopicRegion topicRegion = (TopicRegion) regionBroker.getTopicRegion(); String candidateSubName = getSubscriberName(dest); for (Subscription subscription : topicRegion.getDurableSubscriptions().values()) { String subName = subscription.getConsumerInfo().getSubscriptionName(); serviceRemoteException(e);
@Override protected DemandSubscription createDemandSubscription(ConsumerInfo info) throws IOException { boolean isForcedDurable = NetworkBridgeUtils.isForcedDurable(info, dynamicallyIncludedDestinations, staticallyIncludedDestinations); if (addToAlreadyInterestedConsumers(info, isForcedDurable)) { return null; // don't want this subscription added } //add our original id to ourselves info.addNetworkConsumerId(info.getConsumerId()); ConsumerId forcedDurableId = isForcedDurable ? info.getConsumerId() : null; if(info.isDurable() || isForcedDurable) { // set the subscriber name to something reproducible info.setSubscriptionName(getSubscriberName(info.getDestination())); // and override the consumerId with something unique so that it won't // be removed if the durable subscriber (at the other end) goes away info.setConsumerId(new ConsumerId(localSessionInfo.getSessionId(), consumerIdGenerator.getNextSequenceId())); } info.setSelector(null); DemandSubscription demandSubscription = doCreateDemandSubscription(info); if (forcedDurableId != null) { demandSubscription.addForcedDurableConsumer(forcedDurableId); forcedDurableRemoteId.add(forcedDurableId); } return demandSubscription; }
@Override public String toString() { return "DurableConduitBridge:" + configuration.getBrokerName() + "->" + getRemoteBrokerName(); } /**
@Override public String toString() { return "DurableConduitBridge:" + configuration.getBrokerName() + "->" + getRemoteBrokerName(); } /**
/** * Subscriptions for these destinations are always created * */ protected void setupStaticDestinations() { super.setupStaticDestinations(); ActiveMQDestination[] dests = configuration.isDynamicOnly() ? null : durableDestinations; if (dests != null) { for (int i = 0; i < dests.length; i++) { ActiveMQDestination dest = dests[i]; if (isPermissableDestination(dest) && !doesConsumerExist(dest)) { DemandSubscription sub = createDemandSubscription(dest); if (dest.isTopic()) { sub.getLocalInfo().setSubscriptionName(getSubscriberName(dest)); } try { addSubscription(sub); } catch (IOException e) { LOG.error("Failed to add static destination " + dest, e); } if (LOG.isTraceEnabled()) { LOG.trace("Forwarding messages for durable destination: " + dest); } } } } }
protected DemandSubscription createDemandSubscription(ConsumerInfo info) throws IOException { if (addToAlreadyInterestedConsumers(info)) { return null; // don't want this subscription added } //add our original id to ourselves info.addNetworkConsumerId(info.getConsumerId()); if (info.isDurable()) { // set the subscriber name to something reproducible info.setSubscriptionName(getSubscriberName(info.getDestination())); // and override the consumerId with something unique so that it won't // be removed if the durable subscriber (at the other end) goes away info.setConsumerId(new ConsumerId(localSessionInfo.getSessionId(), consumerIdGenerator .getNextSequenceId())); } info.setSelector(null); return doCreateDemandSubscription(info); }
@Override public DemandForwardingBridge createNetworkBridge(NetworkBridgeConfiguration configuration, Transport localTransport, Transport remoteTransport, NetworkBridgeListener listener) { if (configuration.isConduitSubscriptions()) { // dynamicOnly determines whether durables are auto bridged return attachListener(new DurableConduitBridge(configuration, localTransport, remoteTransport), listener); } return attachListener(new DemandForwardingBridge(configuration, localTransport, remoteTransport), listener); }
@Override public String toString() { return "DurableConduitBridge:" + configuration.getBrokerName() + "->" + getRemoteBrokerName(); } /**
if (dests != null) { for (ActiveMQDestination dest : dests) { if (isPermissableDestination(dest) && !doesConsumerExist(dest)) { try { String candidateSubName = getSubscriberName(dest); for (Subscription subscription : topicRegion.getDurableSubscriptions().values()) { String subName = subscription.getConsumerInfo().getSubscriptionName(); String clientId = subscription.getContext().getClientId(); if (subName != null && subName.equals(candidateSubName) && clientId.startsWith(configuration.getName())) { DemandSubscription sub = createDemandSubscription(dest, subName); if (sub != null) { sub.getLocalInfo().setSubscriptionName(getSubscriberName(dest)); sub.setStaticallyIncluded(true); addSubscription(sub); break; } else if (configuration.isSyncDurableSubs() && !isPermissableDestination(dest)) { if (dest.isTopic()) { RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker(); TopicRegion topicRegion = (TopicRegion) regionBroker.getTopicRegion(); String candidateSubName = getSubscriberName(dest); for (Subscription subscription : topicRegion.getDurableSubscriptions().values()) { String subName = subscription.getConsumerInfo().getSubscriptionName(); serviceRemoteException(e);
@Override protected DemandSubscription createDemandSubscription(ConsumerInfo info) throws IOException { boolean isForcedDurable = NetworkBridgeUtils.isForcedDurable(info, dynamicallyIncludedDestinations, staticallyIncludedDestinations); if (addToAlreadyInterestedConsumers(info, isForcedDurable)) { return null; // don't want this subscription added } //add our original id to ourselves info.addNetworkConsumerId(info.getConsumerId()); ConsumerId forcedDurableId = isForcedDurable ? info.getConsumerId() : null; if(info.isDurable() || isForcedDurable) { // set the subscriber name to something reproducible info.setSubscriptionName(getSubscriberName(info.getDestination())); // and override the consumerId with something unique so that it won't // be removed if the durable subscriber (at the other end) goes away info.setConsumerId(new ConsumerId(localSessionInfo.getSessionId(), consumerIdGenerator.getNextSequenceId())); } info.setSelector(null); DemandSubscription demandSubscription = doCreateDemandSubscription(info); if (forcedDurableId != null) { demandSubscription.addForcedDurableConsumer(forcedDurableId); forcedDurableRemoteId.add(forcedDurableId); } return demandSubscription; }
@Override public DemandForwardingBridge createNetworkBridge(NetworkBridgeConfiguration configuration, Transport localTransport, Transport remoteTransport, NetworkBridgeListener listener) { if (configuration.isConduitSubscriptions()) { // dynamicOnly determines whether durables are auto bridged return attachListener(new DurableConduitBridge(configuration, localTransport, remoteTransport), listener); } return attachListener(new DemandForwardingBridge(configuration, localTransport, remoteTransport), listener); }
@Override public String toString() { return "DurableConduitBridge:" + configuration.getBrokerName() + "->" + getRemoteBrokerName(); } /**
if (dests != null) { for (ActiveMQDestination dest : dests) { if (isPermissableDestination(dest) && !doesConsumerExist(dest)) { try { String candidateSubName = getSubscriberName(dest); for (Subscription subscription : topicRegion.getDurableSubscriptions().values()) { String subName = subscription.getConsumerInfo().getSubscriptionName(); String clientId = subscription.getContext().getClientId(); if (subName != null && subName.equals(candidateSubName) && clientId.startsWith(configuration.getName())) { DemandSubscription sub = createDemandSubscription(dest, subName); if (sub != null) { sub.getLocalInfo().setSubscriptionName(getSubscriberName(dest)); sub.setStaticallyIncluded(true); addSubscription(sub); break; } else if (configuration.isSyncDurableSubs() && !isPermissableDestination(dest)) { if (dest.isTopic()) { RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker(); TopicRegion topicRegion = (TopicRegion) regionBroker.getTopicRegion(); String candidateSubName = getSubscriberName(dest); for (Subscription subscription : topicRegion.getDurableSubscriptions().values()) { String subName = subscription.getConsumerInfo().getSubscriptionName(); serviceRemoteException(e);
@Override protected DemandSubscription createDemandSubscription(ConsumerInfo info) throws IOException { boolean isForcedDurable = NetworkBridgeUtils.isForcedDurable(info, dynamicallyIncludedDestinations, staticallyIncludedDestinations); if (addToAlreadyInterestedConsumers(info, isForcedDurable)) { return null; // don't want this subscription added } //add our original id to ourselves info.addNetworkConsumerId(info.getConsumerId()); ConsumerId forcedDurableId = isForcedDurable ? info.getConsumerId() : null; if(info.isDurable() || isForcedDurable) { // set the subscriber name to something reproducible info.setSubscriptionName(getSubscriberName(info.getDestination())); // and override the consumerId with something unique so that it won't // be removed if the durable subscriber (at the other end) goes away info.setConsumerId(new ConsumerId(localSessionInfo.getSessionId(), consumerIdGenerator.getNextSequenceId())); } info.setSelector(null); DemandSubscription demandSubscription = doCreateDemandSubscription(info); if (forcedDurableId != null) { demandSubscription.addForcedDurableConsumer(forcedDurableId); forcedDurableRemoteId.add(forcedDurableId); } return demandSubscription; }
@Override public DemandForwardingBridge createNetworkBridge(NetworkBridgeConfiguration configuration, Transport localTransport, Transport remoteTransport, NetworkBridgeListener listener) { if (configuration.isConduitSubscriptions()) { // dynamicOnly determines whether durables are auto bridged return attachListener(new DurableConduitBridge(configuration, localTransport, remoteTransport), listener); } return attachListener(new DemandForwardingBridge(configuration, localTransport, remoteTransport), listener); }
if (dests != null) { for (ActiveMQDestination dest : dests) { if (isPermissableDestination(dest) && !doesConsumerExist(dest)) { try { String candidateSubName = getSubscriberName(dest); for (Subscription subscription : topicRegion.getDurableSubscriptions().values()) { String subName = subscription.getConsumerInfo().getSubscriptionName(); String clientId = subscription.getContext().getClientId(); if (subName != null && subName.equals(candidateSubName) && clientId.startsWith(configuration.getName())) { DemandSubscription sub = createDemandSubscription(dest, subName); if (sub != null) { sub.getLocalInfo().setSubscriptionName(getSubscriberName(dest)); sub.setStaticallyIncluded(true); addSubscription(sub); break; } else if (configuration.isSyncDurableSubs() && !isPermissableDestination(dest)) { if (dest.isTopic()) { RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker(); TopicRegion topicRegion = (TopicRegion) regionBroker.getTopicRegion(); String candidateSubName = getSubscriberName(dest); for (Subscription subscription : topicRegion.getDurableSubscriptions().values()) { String subName = subscription.getConsumerInfo().getSubscriptionName(); serviceRemoteException(e);
@Override protected DemandSubscription createDemandSubscription(ConsumerInfo info) throws IOException { boolean isForcedDurable = NetworkBridgeUtils.isForcedDurable(info, dynamicallyIncludedDestinations, staticallyIncludedDestinations); if (addToAlreadyInterestedConsumers(info, isForcedDurable)) { return null; // don't want this subscription added } //add our original id to ourselves info.addNetworkConsumerId(info.getConsumerId()); ConsumerId forcedDurableId = isForcedDurable ? info.getConsumerId() : null; if(info.isDurable() || isForcedDurable) { // set the subscriber name to something reproducible info.setSubscriptionName(getSubscriberName(info.getDestination())); // and override the consumerId with something unique so that it won't // be removed if the durable subscriber (at the other end) goes away info.setConsumerId(new ConsumerId(localSessionInfo.getSessionId(), consumerIdGenerator.getNextSequenceId())); } info.setSelector(null); DemandSubscription demandSubscription = doCreateDemandSubscription(info); if (forcedDurableId != null) { demandSubscription.addForcedDurableConsumer(forcedDurableId); forcedDurableRemoteId.add(forcedDurableId); } return demandSubscription; }
/** * create a network bridge * * @param configuration * @param localTransport * @param remoteTransport * @param listener * @return the NetworkBridge */ public static DemandForwardingBridge createBridge(NetworkBridgeConfiguration configuration, Transport localTransport, Transport remoteTransport, final NetworkBridgeListener listener) { DemandForwardingBridge result = null; if (configuration.isConduitSubscriptions()) { // dynamicOnly determines whether durables are auto bridged result = new DurableConduitBridge(configuration, localTransport, remoteTransport); } else { result = new DemandForwardingBridge(configuration, localTransport, remoteTransport); } if (listener != null) { result.setNetworkBridgeListener(listener); } return result; } }