Exemplo n.º 1
0
        private void OnMessage(InitializeSwitchboard message)
        {
            this.switchboard = message.Switchboard;
            this.switchboard.RegisterDeadLetterChannel(this.AddToDeadLetters);

            this.Logger.LogDebug(LogId.Component, "Switchboard initialized.");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageBus{T}"/> class.
        /// </summary>
        /// <param name="container">The componentry container.</param>
        public MessageBus(IComponentryContainer container)
            : base(container)
        {
            this.deadLetters      = new List <object>();
            this.subscriptionsAll = new List <Mailbox>();
            this.subscriptions    = new Dictionary <Type, List <Mailbox> >();

            this.switchboard = Switchboard.Empty();

            this.RegisterHandler <IEnvelope>(this.OnReceive);
            this.RegisterHandler <InitializeSwitchboard>(this.OnMessage);
            this.RegisterHandler <Subscribe <Type> >(this.OnMessage);
            this.RegisterHandler <Unsubscribe <Type> >(this.OnMessage);
        }