private void OnMessage(InitializeSwitchboard message) { this.switchboard = message.Switchboard; this.switchboard.RegisterDeadLetterChannel(this.AddToDeadLetters); this.Logger.LogDebug(LogId.Component, "Switchboard initialized."); }
/// <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); }