public void Register(ExchangeListener exchangeListener)
 {
     lock (_lock) {
         this._exchangeListeners.Add(exchangeListener.Name, exchangeListener);
     }
     this.SendToServer("SUBSCRIBE:" + this._clientId + ":" + exchangeListener.ExchangeName);
 }
        private void SetUp()
        {
            DomainEventPublisher.Instance.Reset();

            SlothServer.ExecuteInProcessDetachedServer();

            Thread.Sleep(500);

            _phoneNumberExecutive = new PhoneNumberExecutive();
            _phoneNumberFinder = new PhoneNumberFinder();
            _matchtedPhoneNumberCounter = new MatchtedPhoneNumberCounter();
            _totalPhoneNumbersCounter = new TotalPhoneNumbersCounter();

            SlothClient.Instance.Register(this._phoneNumberExecutive);
            SlothClient.Instance.Register(this._phoneNumberFinder);
            SlothClient.Instance.Register(this._matchtedPhoneNumberCounter);
            SlothClient.Instance.Register(this._totalPhoneNumbersCounter);

            _publisher = new ExchangePublisher("PhoneNumberExchange");
        }
 public void UnRegister(ExchangeListener exchangeListener)
 {
     lock (_lock) {
         this._exchangeListeners.Remove(exchangeListener.Name);
     }
     this.SendToServer("UNSUBSCRIBE:" + this._clientId + ":" + exchangeListener.ExchangeName);
 }