Example #1
0
        /// <summary>
        ///     Stores the publication
        /// </summary>
        /// <param name="siteName"></param>
        /// <param name="message"></param>
        public void StorePublication(string siteName, string[] message)
        {
            lock (this._publicationHistory)
            {
                string publisher = message[0];
                int seqNo = int.Parse(message[4]);

                // gets or creates the history of messages for the given site
                IDictionary<string, ProcessHistory> procToHistory;
                if (!this._publicationHistory.TryGetValue(siteName, out procToHistory))
                {
                    procToHistory = new ConcurrentDictionary<string, ProcessHistory>();
                    this._publicationHistory[siteName] = procToHistory;
                }

                // gets or creates the history of messages for the given publisher
                ProcessHistory procHistory;
                if (!procToHistory.TryGetValue(publisher, out procHistory))
                {
                    procHistory = new ProcessHistory();
                    procToHistory[publisher] = procHistory;
                }

                // adds the message to the process' history
                procHistory.AddMessage(message, seqNo);
            }
        }
Example #2
0
        public void StoreSubscription(string subscriber, string topic, int sequenceNumber)
        {
            // gets or creates the history of messages for the given subscriber
            ProcessHistory processHistory;
            if (!this.SubscriptionHistory.TryGetValue(subscriber, out processHistory))
            {
                processHistory = new ProcessHistory();
                this.SubscriptionHistory[subscriber] = processHistory;
            }

            // adds the message to the process' history
            processHistory.AddMessage(new[] {subscriber, topic, sequenceNumber.ToString()}, sequenceNumber);
        }