Пример #1
0
        public override async Task <IReadOnlyDictionary <string, object> > GetRoutingTable(IConnection connection, string database, Bookmark bookmark)
        {
            connection = connection ?? throw new ProtocolException("Attempting to get a routing table on a null connection");

            var responseHandler = new RouteResponseHandler();

            await connection.EnqueueAsync(new RouteMessage(connection.RoutingContext, database), responseHandler).ConfigureAwait(false);

            await connection.SyncAsync().ConfigureAwait(false);

            await connection.CloseAsync().ConfigureAwait(false);

            return((IReadOnlyDictionary <string, object>)responseHandler.RoutingInformation);
        }
Пример #2
0
      public override async Task <IReadOnlyDictionary <string, object> > GetRoutingTable(IConnection connection, string database, string impersonatedUser, Bookmark bookmark)
      {
          connection = connection ?? throw new ProtocolException("Attempting to get a routing table on a null connection");

          var responseHandler = new RouteResponseHandler();

          await connection.EnqueueAsync(new RouteMessage(connection.RoutingContext, bookmark, database), responseHandler).ConfigureAwait(false);

          await connection.SyncAsync().ConfigureAwait(false);

          await connection.CloseAsync().ConfigureAwait(false);

          //Since 4.4 the Routing information will contain a db. 4.3 needs to populate this here as it's not received in the older route response...
          responseHandler.RoutingInformation.Add(RoutingTableDBKey, database);

          return((IReadOnlyDictionary <string, object>)responseHandler.RoutingInformation);
      }