private async Task <IConnection> CreateClusterConnectionAsync(Uri uri, AccessMode mode, string database, Bookmark bookmark) { try { var conn = await _clusterConnectionPool.AcquireAsync(uri, mode, database, bookmark) .ConfigureAwait(false); if (conn != null) { return(new ClusterConnection(conn, uri, this)); } await OnConnectionErrorAsync(uri, database, new ArgumentException( $"Routing table {_routingTableManager.RoutingTableFor(database)} contains a server {uri} " + $"that is not known to cluster connection pool {_clusterConnectionPool}.")).ConfigureAwait(false); } catch (ServiceUnavailableException e) { await OnConnectionErrorAsync(uri, database, e).ConfigureAwait(false); } return(null); }
public IRoutingTable GetRoutingTable(string database) { return(_routingTableManager.RoutingTableFor(database)); }