@Test public void testConsumerRemovedIgnoresConsumersWithoutSubscriptions() { AmqpSubscriptionTracker tracker = new AmqpSubscriptionTracker(); JmsConsumerInfo subInfo1 = createConsumerInfo(null, "myTopic", true, true, true); tracker.consumerRemoved(subInfo1); JmsConsumerInfo subInfo2 = createConsumerInfo("", "myTopic", true, true, true); tracker.consumerRemoved(subInfo2); }
public void consumerRemoved(JmsConsumerInfo consumerInfo) { String subscriptionName = consumerInfo.getSubscriptionName(); if (subscriptionName != null && !subscriptionName.isEmpty()) { if (consumerInfo.isShared()) { if (consumerInfo.isDurable()) { if(sharedDurableSubs.containsKey(subscriptionName)) { SubDetails subDetails = sharedDurableSubs.get(subscriptionName); subDetails.removeSubscriber(consumerInfo); int count = subDetails.activeSubscribers(); if(count < 1) { sharedDurableSubs.remove(subscriptionName); } } } else { if(sharedVolatileSubs.containsKey(subscriptionName)) { SubDetails subDetails = sharedVolatileSubs.get(subscriptionName); subDetails.removeSubscriber(consumerInfo); int count = subDetails.activeSubscribers(); if(count < 1) { sharedVolatileSubs.remove(subscriptionName); } } } } else if (consumerInfo.isDurable()) { exclusiveDurableSubs.remove(subscriptionName); } } }
AmqpSubscriptionTracker { public void consumerRemoved(JmsConsumerInfo consumerInfo) { String subscriptionName = consumerInfo.getSubscriptionName(); if (subscriptionName != null && !subscriptionName.isEmpty()) { if (consumerInfo.isShared()) { if (consumerInfo.isDurable()) { if(sharedDurableSubs.containsKey(subscriptionName)) { SubDetails subDetails = sharedDurableSubs.get(subscriptionName); subDetails.removeSubscriber(consumerInfo); int count = subDetails.activeSubscribers(); if(count < 1) { sharedDurableSubs.remove(subscriptionName); } } } else { if(sharedVolatileSubs.containsKey(subscriptionName)) { SubDetails subDetails = sharedVolatileSubs.get(subscriptionName); subDetails.removeSubscriber(consumerInfo); int count = subDetails.activeSubscribers(); if(count < 1) { sharedVolatileSubs.remove(subscriptionName); } } } } else if (consumerInfo.isDurable()) { exclusiveDurableSubs.remove(subscriptionName); } } } }
AmqpSubscriptionTracker { public void consumerRemoved(JmsConsumerInfo consumerInfo) { String subscriptionName = consumerInfo.getSubscriptionName(); if (subscriptionName != null && !subscriptionName.isEmpty()) { if (consumerInfo.isShared()) { if (consumerInfo.isDurable()) { if(sharedDurableSubs.containsKey(subscriptionName)) { SubDetails subDetails = sharedDurableSubs.get(subscriptionName); subDetails.removeSubscriber(consumerInfo); int count = subDetails.activeSubscribers(); if(count < 1) { sharedDurableSubs.remove(subscriptionName); } } } else { if(sharedVolatileSubs.containsKey(subscriptionName)) { SubDetails subDetails = sharedVolatileSubs.get(subscriptionName); subDetails.removeSubscriber(consumerInfo); int count = subDetails.activeSubscribers(); if(count < 1) { sharedVolatileSubs.remove(subscriptionName); } } } } else if (consumerInfo.isDurable()) { exclusiveDurableSubs.remove(subscriptionName); } } }  }
AmqpSubscriptionTracker { public void consumerRemoved(JmsConsumerInfo consumerInfo) { String subscriptionName = consumerInfo.getSubscriptionName(); if (subscriptionName != null && !subscriptionName.isEmpty()) { if (consumerInfo.isShared()) { if (consumerInfo.isDurable()) { if(sharedDurableSubs.containsKey(subscriptionName)) { SubDetails subDetails = sharedDurableSubs.get(subscriptionName); subDetails.removeSubscriber(consumerInfo); int count = subDetails.activeSubscribers(); if(count < 1) { sharedDurableSubs.remove(subscriptionName); } } } else { if(sharedVolatileSubs.containsKey(subscriptionName)) { SubDetails subDetails = sharedVolatileSubs.get(subscriptionName); subDetails.removeSubscriber(consumerInfo); int count = subDetails.activeSubscribers(); if(count < 1) { sharedVolatileSubs.remove(subscriptionName); } } } } else if (consumerInfo.isDurable()) { exclusiveDurableSubs.remove(subscriptionName); } } }  String reserveNextSubscriptionLinkName(String subscriptionName, JmsConsumerInfo consumerInfo); String getFirstDurableSubscriptionLinkName(String subscriptionName, boolean hasClientID); boolean isActiveExclusiveDurableSub(String subscriptionName); boolean isActiveSharedDurableSub(String subscriptionName); boolean isActiveDurableSub(String subscriptionName); boolean isActiveSharedVolatileSub(String subscriptionName); void consumerRemoved(JmsConsumerInfo consumerInfo); }
AmqpSubscriptionTracker { public void consumerRemoved(JmsConsumerInfo consumerInfo) { String subscriptionName = consumerInfo.getSubscriptionName(); if (subscriptionName != null && !subscriptionName.isEmpty()) { if (consumerInfo.isShared()) { if (consumerInfo.isDurable()) { if(sharedDurableSubs.containsKey(subscriptionName)) { SubDetails subDetails = sharedDurableSubs.get(subscriptionName); subDetails.removeSubscriber(consumerInfo); int count = subDetails.activeSubscribers(); if(count < 1) { sharedDurableSubs.remove(subscriptionName); } } } else { if(sharedVolatileSubs.containsKey(subscriptionName)) { SubDetails subDetails = sharedVolatileSubs.get(subscriptionName); subDetails.removeSubscriber(consumerInfo); int count = subDetails.activeSubscribers(); if(count < 1) { sharedVolatileSubs.remove(subscriptionName); } } } } else if (consumerInfo.isDurable()) { exclusiveDurableSubs.remove(subscriptionName); } } }  String reserveNextSubscriptionLinkName(String subscriptionName, JmsConsumerInfo consumerInfo); String getFirstDurableSubscriptionLinkName(String subscriptionName, boolean hasClientID); boolean isActiveExclusiveDurableSub(String subscriptionName); boolean isActiveSharedDurableSub(String subscriptionName); boolean isActiveDurableSub(String subscriptionName); boolean isActiveSharedVolatileSub(String subscriptionName); void consumerRemoved(JmsConsumerInfo consumerInfo);  }