Exemple #1
0
        private string GetSharedDurableSubLinkName(string subscriptionName, NmsConsumerInfo consumerInfo)
        {
            IDestination topic    = consumerInfo.Destination;
            string       selector = consumerInfo.Selector;

            SubDetails subDetails = null;

            if (sharedDurableSubs.ContainsKey(subscriptionName))
            {
                subDetails = sharedDurableSubs[subscriptionName];

                if (subDetails.Matches(topic, selector))
                {
                    subDetails.AddSubscriber(consumerInfo);
                }
                else
                {
                    throw new NMSException("Subscription details dont match existing subscriber.");
                }
            }
            else
            {
                subDetails = new SubDetails(topic, selector, consumerInfo);
            }

            sharedDurableSubs.Add(subscriptionName, subDetails);

            int count = subDetails.TotalSubscriberCount();

            return(GetDurableSubscriptionLinkName(subscriptionName, consumerInfo.IsExplicitClientId, count));
        }
Exemple #2
0
        private String GetSharedVolatileSubLinkName(string subscriptionName, NmsConsumerInfo consumerInfo)
        {
            IDestination topic    = consumerInfo.Destination;
            string       selector = consumerInfo.Selector;

            SubDetails subDetails = null;

            if (sharedVolatileSubs.ContainsKey(subscriptionName))
            {
                subDetails = sharedVolatileSubs[subscriptionName];

                if (subDetails.Matches(topic, selector))
                {
                    subDetails.AddSubscriber(consumerInfo);
                }
                else
                {
                    throw new NMSException("Subscription details dont match existing subscriber");
                }
            }
            else
            {
                subDetails = new SubDetails(topic, selector, consumerInfo);
            }

            sharedVolatileSubs.Add(subscriptionName, subDetails);

            string receiverLinkName = subscriptionName + SUB_NAME_DELIMITER;
            int    count            = subDetails.TotalSubscriberCount();

            if (consumerInfo.IsExplicitClientId)
            {
                receiverLinkName += "volatile" + count;
            }
            else
            {
                receiverLinkName += "global-volatile" + count;
            }

            return(receiverLinkName);
        }