@Test public void testReserveNextSubscriptionLinkNameSharedVolatileWithNonMatchingTopic() { String topicName = "myTopic"; String subscriptionName1 = "mySubscription1"; AmqpSubscriptionTracker tracker = new AmqpSubscriptionTracker(); JmsConsumerInfo sub1consumer1 = createConsumerInfo(subscriptionName1, topicName, true, false, true); assertEquals("Unexpected first sub link name", subscriptionName1 + SUB_NAME_DELIMITER + "volatile1", tracker.reserveNextSubscriptionLinkName(subscriptionName1, sub1consumer1)); JmsConsumerInfo sub1consumer2 = createConsumerInfo(subscriptionName1, topicName + "-alt", true, false, true); try { tracker.reserveNextSubscriptionLinkName(subscriptionName1, sub1consumer2); fail("Expected JMSRuntimeException when Topic doesn't match previous subscription"); } catch (JMSRuntimeException jmsre) { } }
public String reserveNextSubscriptionLinkName(String subscriptionName, JmsConsumerInfo consumerInfo) { validateSubscriptionName(subscriptionName); if(consumerInfo == null) { throw new IllegalArgumentException("Consumer info must not be null."); } if (consumerInfo.isShared()) { if (consumerInfo.isDurable()) { return getSharedDurableSubLinkName(subscriptionName, consumerInfo); } else { return getSharedVolatileSubLinkName(subscriptionName, consumerInfo); } } else if (consumerInfo.isDurable()) { registerExclusiveDurableSub(subscriptionName); return subscriptionName; } else { throw new IllegalStateException("Non-shared non-durable sub link naming is not handled by the tracker."); } }
AmqpSubscriptionTracker { public String reserveNextSubscriptionLinkName(String subscriptionName, JmsConsumerInfo consumerInfo) { validateSubscriptionName(subscriptionName); if(consumerInfo == null) { throw new IllegalArgumentException("Consumer info must not be null."); } if (consumerInfo.isShared()) { if (consumerInfo.isDurable()) { return getSharedDurableSubLinkName(subscriptionName, consumerInfo); } else { return getSharedVolatileSubLinkName(subscriptionName, consumerInfo); } } else if (consumerInfo.isDurable()) { registerExclusiveDurableSub(subscriptionName); return subscriptionName; } else { throw new IllegalStateException("Non-shared non-durable sub link naming is not handled by the tracker."); } } }
AmqpSubscriptionTracker { public String reserveNextSubscriptionLinkName(String subscriptionName, JmsConsumerInfo consumerInfo) { validateSubscriptionName(subscriptionName); if(consumerInfo == null) { throw new IllegalArgumentException("Consumer info must not be null."); } if (consumerInfo.isShared()) { if (consumerInfo.isDurable()) { return getSharedDurableSubLinkName(subscriptionName, consumerInfo); } else { return getSharedVolatileSubLinkName(subscriptionName, consumerInfo); } } else if (consumerInfo.isDurable()) { registerExclusiveDurableSub(subscriptionName); return subscriptionName; } else { throw new IllegalStateException("Non-shared non-durable sub link naming is not handled by the tracker."); } }  }
AmqpSubscriptionTracker { public String reserveNextSubscriptionLinkName(String subscriptionName, JmsConsumerInfo consumerInfo) { validateSubscriptionName(subscriptionName); if(consumerInfo == null) { throw new IllegalArgumentException("Consumer info must not be null."); } if (consumerInfo.isShared()) { if (consumerInfo.isDurable()) { return getSharedDurableSubLinkName(subscriptionName, consumerInfo); } else { return getSharedVolatileSubLinkName(subscriptionName, consumerInfo); } } else if (consumerInfo.isDurable()) { registerExclusiveDurableSub(subscriptionName); return subscriptionName; } else { throw new IllegalStateException("Non-shared non-durable sub link naming is not handled by the tracker."); } }  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 String reserveNextSubscriptionLinkName(String subscriptionName, JmsConsumerInfo consumerInfo) { validateSubscriptionName(subscriptionName); if(consumerInfo == null) { throw new IllegalArgumentException("Consumer info must not be null."); } if (consumerInfo.isShared()) { if (consumerInfo.isDurable()) { return getSharedDurableSubLinkName(subscriptionName, consumerInfo); } else { return getSharedVolatileSubLinkName(subscriptionName, consumerInfo); } } else if (consumerInfo.isDurable()) { registerExclusiveDurableSub(subscriptionName); return subscriptionName; } else { throw new IllegalStateException("Non-shared non-durable sub link naming is not handled by the tracker."); } }  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);  }