Пример #1
0
        public void NewSubscriberSynchronous(string topicUrl, string callBackUrl, string verifyToken)
        {
            if (!_topics.ContainsKey(topicUrl))
            {
                throw new KeyNotFoundException(string.Format("Topic '{0}' is not registered.", topicUrl));
            }

            Logger.InfoFormat("New subscriber [{0}] for topic '{1}'", callBackUrl, topicUrl);

            //do verification of new subscriber
            if (!_subscriptionVerifier.Verify(callBackUrl, topicUrl, verifyToken))
            {
                Logger.InfoFormat("Subscription from [{0}] was not verified.", callBackUrl);
            }

            _topics.AddOrUpdate(topicUrl, s => new List <Subscriber> {
                new Subscriber(callBackUrl, true)
            },
                                (s, list) =>
            {
                list.Add(new Subscriber(callBackUrl, true));
                return(list);
            });
        }