Beispiel #1
0
        /// <summary>
        /// Registers the message consumer.
        /// </summary>
        /// <param name="consumer">Consumer.</param>
        public void RegisterMessageConsumer (IMessageConsumer consumer)
        {
            Logger.Log.AddLogEntry(LogLevel.Fine, ClassName, "Registering new message consumer '{0}'",
                consumer.GetType().ToString());

            DeferredRegisters.Enqueue (() => consumer.ValidMessages.ForEach (i =>
                {
                    List<IMessageConsumer> tmp;
                    if (MessageList.TryGetValue(i, out tmp))
                        tmp.Add(consumer);
                    else
                    {
                        tmp = new List<IMessageConsumer>(consumer.ToCollection());
                        MessageList[i] = tmp;
                    }
                })
            );
        }