Пример #1
0
        public ConsumerState this[ConsumerId id]
        {
            get
            {
                ConsumerState consumerState = null;

                consumers.TryGetValue(id, out consumerState);

#if DEBUG
                if (null == consumerState)
                {
                    // Useful for dignosing missing consumer ids
                    string consumerList = string.Empty;
                    foreach (ConsumerId consumerId in consumers.Keys)
                    {
                        consumerList += consumerId.ToString() + "\n";
                    }

                    System.Diagnostics.Debug.Assert(false,
                                                    string.Format("Consumer '{0}' did not exist in the consumers collection.\n\nConsumers:-\n{1}", id, consumerList));
                }
#endif
                return(consumerState);
            }
        }
Пример #2
0
        public ConsumerState removeConsumer(ConsumerId id)
        {
            ConsumerState ret = consumers[id];

            consumers.Remove(id);
            return(ret);
        }
Пример #3
0
        public ConsumerState removeConsumer(ConsumerId id)
        {
            ConsumerState ret = null;

            consumers.TryGetValue(id, out ret);
            consumers.Remove(id);
            return(ret);
        }
Пример #4
0
        public void addConsumer(ConsumerInfo info)
        {
            checkShutdown();

            ConsumerState consumerState = new ConsumerState(info);

            if (consumers.ContainsKey(info.ConsumerId))
            {
                consumers[info.ConsumerId] = consumerState;
            }
            else
            {
                consumers.Add(info.ConsumerId, consumerState);
            }
        }