if (subscriptions.get(sub.getConsumerInfo().getConsumerId()) != null) { super.removeConsumer(context, sub.getConsumerInfo()); } else {
if (info != null) { if (hasDurableSubChanged(info, subscription.getConsumerInfo())) { subscription.setSelector(subscription.getConsumerInfo().getSelector()); synchronized (consumers) { consumers.remove(subscription); info = new SubscriptionInfo(); info.setClientId(clientId); info.setSelector(subscription.getConsumerInfo().getSelector()); info.setSubscriptionName(subscriptionName); info.setDestination(getActiveMQDestination()); info.setNoLocal(subscription.getConsumerInfo().isNoLocal()); info.setSubscribedDestination(subscription.getConsumerInfo().getDestination()); topicStore.addSubscription(info, subscription.getConsumerInfo().isRetroactive());
if (sub != null && NetworkBridgeUtils.matchesNetworkConfig(config, sub.getConsumerInfo().getDestination())) { ConsumerInfo ci = sub.getConsumerInfo().copy(); ci.setClientId(key.getClientId()); subscriptionInfos.add(ci);
@Override public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception { SubscriptionKey key = new SubscriptionKey(context.getClientId(), info.getSubscriptionName()); RegionBroker regionBroker = null; if (next instanceof RegionBroker) { regionBroker = (RegionBroker) next; } else { BrokerService service = next.getBrokerService(); regionBroker = (RegionBroker) service.getRegionBroker(); } if (regionBroker == null) { LOG.warn("Cannot locate a RegionBroker instance to pass along the removeSubscription call"); throw new IllegalStateException("No RegionBroker found."); } DurableTopicSubscription sub = ((TopicRegion) regionBroker.getTopicRegion()).getDurableSubscription(key); super.removeSubscription(context, info); if (sub == null) { LOG.warn("We cannot send an advisory message for a durable sub removal when we don't know about the durable sub"); return; } ActiveMQDestination dest = sub.getConsumerInfo().getDestination(); // Don't advise advisory topics. if (!AdvisorySupport.isAdvisoryTopic(dest)) { ActiveMQTopic topic = AdvisorySupport.getConsumerAdvisoryTopic(dest); fireConsumerAdvisory(context, dest, topic, info); } }
if (hasDurableSubChanged(info, sub.getConsumerInfo())) { destinationsLock.readLock().unlock(); super.removeConsumer(context, sub.getConsumerInfo()); super.addConsumer(context, info); sub = durableSubscriptions.get(key); } else { if (sub.getConsumerInfo().getConsumerId() != null) { subscriptions.remove(sub.getConsumerInfo().getConsumerId());
@Override public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception { SubscriptionKey key = new SubscriptionKey(info.getClientId(), info.getSubscriptionName()); DurableTopicSubscription sub = durableSubscriptions.remove(key); if (sub == null) { throw new InvalidDestinationException("No durable subscription exists for: " + info.getSubscriptionName()); } if (sub.isActive()) { throw new JMSException("Durable consumer is in use"); } synchronized (destinationsMutex) { for (Iterator<Destination> iter = destinations.values().iterator(); iter.hasNext();) { Destination dest = iter.next(); //Account for virtual destinations if (dest instanceof Topic){ Topic topic = (Topic)dest; topic.deleteSubscription(context, key); } } } if (subscriptions.get(sub.getConsumerInfo()) != null) { super.removeConsumer(context, sub.getConsumerInfo()); } else { // try destroying inactive subscriptions destroySubscription(sub); } }
if (subscriptions.get(sub.getConsumerInfo().getConsumerId()) != null) { super.removeConsumer(context, sub.getConsumerInfo()); } else {
ConsumerInfo lookupSubscription(String subscriptionName) throws AmqpProtocolException { ConsumerInfo result = null; RegionBroker regionBroker; try { regionBroker = (RegionBroker) brokerService.getBroker().getAdaptor(RegionBroker.class); } catch (Exception e) { throw new AmqpProtocolException("Error finding subscription: " + subscriptionName + ": " + e.getMessage(), false, e); } final TopicRegion topicRegion = (TopicRegion) regionBroker.getTopicRegion(); DurableTopicSubscription subscription = topicRegion.lookupSubscription(subscriptionName, connectionInfo.getClientId()); if (subscription != null) { result = subscription.getConsumerInfo(); } return result; }
ConsumerInfo lookupSubscription(String subscriptionName) throws AmqpProtocolException { ConsumerInfo result = null; RegionBroker regionBroker; try { regionBroker = (RegionBroker) brokerService.getBroker().getAdaptor(RegionBroker.class); } catch (Exception e) { throw new AmqpProtocolException("Error finding subscription: " + subscriptionName + ": " + e.getMessage(), false, e); } final TopicRegion topicRegion = (TopicRegion) regionBroker.getTopicRegion(); DurableTopicSubscription subscription = topicRegion.lookupSubscription(subscriptionName, connectionInfo.getClientId()); if (subscription != null) { result = subscription.getConsumerInfo(); } return result; }
if (subscriptions.get(sub.getConsumerInfo().getConsumerId()) != null) { super.removeConsumer(context, sub.getConsumerInfo()); } else {
if (subscriptions.get(sub.getConsumerInfo().getConsumerId()) != null) { super.removeConsumer(context, sub.getConsumerInfo()); } else {
if (hasDurableSubChanged(info, sub.getConsumerInfo())) { super.removeConsumer(context, sub.getConsumerInfo()); super.addConsumer(context, info); sub = durableSubscriptions.get(key); } else { if (sub.getConsumerInfo().getConsumerId() != null) { subscriptions.remove(sub.getConsumerInfo().getConsumerId());
if (sub != null && NetworkBridgeUtils.matchesNetworkConfig(config, sub.getConsumerInfo().getDestination())) { ConsumerInfo ci = sub.getConsumerInfo().copy(); ci.setClientId(key.getClientId()); subscriptionInfos.add(ci);
@Override public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception { SubscriptionKey key = new SubscriptionKey(context.getClientId(), info.getSubscriptionName()); RegionBroker regionBroker = null; if (next instanceof RegionBroker) { regionBroker = (RegionBroker) next; } else { BrokerService service = next.getBrokerService(); regionBroker = (RegionBroker) service.getRegionBroker(); } if (regionBroker == null) { LOG.warn("Cannot locate a RegionBroker instance to pass along the removeSubscription call"); throw new IllegalStateException("No RegionBroker found."); } DurableTopicSubscription sub = ((TopicRegion) regionBroker.getTopicRegion()).getDurableSubscription(key); super.removeSubscription(context, info); if (sub == null) { LOG.warn("We cannot send an advisory message for a durable sub removal when we don't know about the durable sub"); return; } ActiveMQDestination dest = sub.getConsumerInfo().getDestination(); // Don't advise advisory topics. if (!AdvisorySupport.isAdvisoryTopic(dest)) { ActiveMQTopic topic = AdvisorySupport.getConsumerAdvisoryTopic(dest); fireConsumerAdvisory(context, dest, topic, info); } }
@Override public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception { SubscriptionKey key = new SubscriptionKey(context.getClientId(), info.getSubscriptionName()); RegionBroker regionBroker = null; if (next instanceof RegionBroker) { regionBroker = (RegionBroker) next; } else { BrokerService service = next.getBrokerService(); regionBroker = (RegionBroker) service.getRegionBroker(); } if (regionBroker == null) { LOG.warn("Cannot locate a RegionBroker instance to pass along the removeSubscription call"); throw new IllegalStateException("No RegionBroker found."); } DurableTopicSubscription sub = ((TopicRegion) regionBroker.getTopicRegion()).getDurableSubscription(key); super.removeSubscription(context, info); if (sub == null) { LOG.warn("We cannot send an advisory message for a durable sub removal when we don't know about the durable sub"); return; } ActiveMQDestination dest = sub.getConsumerInfo().getDestination(); // Don't advise advisory topics. if (!AdvisorySupport.isAdvisoryTopic(dest)) { ActiveMQTopic topic = AdvisorySupport.getConsumerAdvisoryTopic(dest); fireConsumerAdvisory(context, dest, topic, info); } }
if (sub != null && NetworkBridgeUtils.matchesNetworkConfig(config, sub.getConsumerInfo().getDestination())) { ConsumerInfo ci = sub.getConsumerInfo().copy(); ci.setClientId(key.getClientId()); subscriptionInfos.add(ci);
if (sub != null && NetworkBridgeUtils.matchesNetworkConfig(config, sub.getConsumerInfo().getDestination())) { ConsumerInfo ci = sub.getConsumerInfo().copy(); ci.setClientId(key.getClientId()); subscriptionInfos.add(ci);
@Override public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception { SubscriptionKey key = new SubscriptionKey(context.getClientId(), info.getSubscriptionName()); RegionBroker regionBroker = null; if (next instanceof RegionBroker) { regionBroker = (RegionBroker) next; } else { BrokerService service = next.getBrokerService(); regionBroker = (RegionBroker) service.getRegionBroker(); } if (regionBroker == null) { LOG.warn("Cannot locate a RegionBroker instance to pass along the removeSubscription call"); throw new IllegalStateException("No RegionBroker found."); } DurableTopicSubscription sub = ((TopicRegion) regionBroker.getTopicRegion()).getDurableSubscription(key); super.removeSubscription(context, info); if (sub == null) { LOG.warn("We cannot send an advisory message for a durable sub removal when we don't know about the durable sub"); return; } ActiveMQDestination dest = sub.getConsumerInfo().getDestination(); // Don't advise advisory topics. if (!AdvisorySupport.isAdvisoryTopic(dest)) { ActiveMQTopic topic = AdvisorySupport.getConsumerAdvisoryTopic(dest); fireConsumerAdvisory(context, dest, topic, info); } }
if (hasDurableSubChanged(info, sub.getConsumerInfo())) { destinationsLock.readLock().unlock(); super.removeConsumer(context, sub.getConsumerInfo()); super.addConsumer(context, info); sub = durableSubscriptions.get(key); } else { if (sub.getConsumerInfo().getConsumerId() != null) { subscriptions.remove(sub.getConsumerInfo().getConsumerId());
if (hasDurableSubChanged(info, sub.getConsumerInfo())) { destinationsLock.readLock().unlock(); super.removeConsumer(context, sub.getConsumerInfo()); super.addConsumer(context, info); sub = durableSubscriptions.get(key); } else { if (sub.getConsumerInfo().getConsumerId() != null) { subscriptions.remove(sub.getConsumerInfo().getConsumerId());