Beispiel #1
0
        public void Unregister(IBus bus)
        {
            var command = new UnregisterPeerCommand(_self, _timestampProvider.NextUtcTimestamp());

            // using a cache of the directory peers in case of the underlying configuration proxy values changed before stopping (Abc.gestion...)
            if (!_directoryPeers.Any(peer => bus.Send(command, peer).Wait(5.Seconds())))
            {
                throw new TimeoutException("Unable to unregister peer on directory");
            }
        }
Beispiel #2
0
        public async Task UnregisterAsync(IBus bus)
        {
            var command = new UnregisterPeerCommand(_self, _timestampProvider.NextUtcTimestamp());

            // Using a cache of the directory peers in case of the underlying configuration proxy values changed before stopping
            foreach (var directoryPeer in _directoryPeers)
            {
                try
                {
                    await bus.Send(command, directoryPeer).WithTimeoutAsync(_configuration.RegistrationTimeout).ConfigureAwait(false);

                    return;
                }
                catch (TimeoutException ex)
                {
                    _logger.Error(ex);
                }
            }

            throw new TimeoutException("Unable to unregister peer on directory");
        }