protected override async Task StopRider(CancellationToken cancellationToken) { await _producerSharedContext.DisposeAsync().ConfigureAwait(false); if (_endpoints == null || !_endpoints.Any()) { return; } await Task.WhenAll(_endpoints.Select(endpoint => endpoint.Disconnect(cancellationToken))).ConfigureAwait(false); }