Пример #1
0
        /// <summary>
        /// 注销指定会话的所有外部事件订阅者
        /// </summary>
        /// <param name="sessionId">会话Id</param>
        public void UnRegisterAllOuterEventSubscriber(string sessionId)
        {
            if (eventCollectors.ContainsKey(sessionId))
            {
                eventCollectors[sessionId].Dispose();
                if (outerSubscriberMapping.ContainsKey(sessionId))
                {
                    foreach (string topic in outerSubscriberMapping[sessionId])
                    {
                        RemoveEventSubscriber(sessionId + topic);
                        RemoveOuterSubscriberFromPublisherInfo(sessionId + topic);
                    }
                }
                eventCollectors.Remove(sessionId);
            }
            if (outerSubscriberMapping.ContainsKey(sessionId))
            {
                outerSubscriberMapping.Remove(sessionId);
            }
            OuterEventInfo template = new OuterEventInfo();

            template.SessionId = sessionId;

            IList <OuterEventInfo> events = db.Load <OuterEventInfo>(template);

            foreach (OuterEventInfo info in events)
            {
                db.Delete(info);
            }
        }
Пример #2
0
        public void UnRegisterAnOuterEventSubscriber(string sessionId, string topic)
        {
            if (eventCollectors.ContainsKey(sessionId))
            {
                eventCollectors[sessionId].UnRegisterEvent(topic);
            }
            RemoveEventSubscriber(sessionId + topic);
            if (outerSubscriberMapping.ContainsKey(sessionId))
            {
                outerSubscriberMapping[sessionId].Remove(topic);
            }
            RemoveOuterSubscriberFromPublisherInfo(sessionId + topic);
            OuterEventInfo template = new OuterEventInfo();

            template.SessionId = sessionId;
            template.Topic     = topic;

            IList <OuterEventInfo> events = db.Load <OuterEventInfo>(template);

            foreach (OuterEventInfo info in events)
            {
                db.Delete(info);
            }
        }
Пример #3
0
        /// <summary>
        /// 注销指定会话的所有外部事件订阅者
        /// </summary>
        /// <param name="sessionId">会话Id</param>
        public void UnRegisterAllOuterEventSubscriber(string sessionId)
        {
            if (eventCollectors.ContainsKey(sessionId))
            {
                eventCollectors[sessionId].Dispose();
                if (outerSubscriberMapping.ContainsKey(sessionId)) {
                    foreach (string topic in outerSubscriberMapping[sessionId]) {
                        RemoveEventSubscriber(sessionId + topic);
                        RemoveOuterSubscriberFromPublisherInfo(sessionId + topic);
                    }
                }
                eventCollectors.Remove(sessionId);
            }
            if (outerSubscriberMapping.ContainsKey(sessionId)) outerSubscriberMapping.Remove(sessionId);
            OuterEventInfo template = new OuterEventInfo();
            template.SessionId = sessionId;

            IList<OuterEventInfo> events = db.Load<OuterEventInfo>(template);
            foreach (OuterEventInfo info in events)
            {
                db.Delete(info);
            }
        }