Exemple #1
0
        public virtual async Task <IConnection> DoCreateAndOpen(bool isReconnection)
        {
            var endPoint = await _config.EndPointResolver.GetConnectionEndPointAsync(_host, isReconnection).ConfigureAwait(false);

            var c = _config.ConnectionFactory.Create(_serializer, endPoint, _config, _observerFactory.CreateConnectionObserver(_host));

            try
            {
                await c.Open().ConfigureAwait(false);
            }
            catch
            {
                c.Dispose();
                throw;
            }
            if (_poolingOptions.GetHeartBeatInterval() > 0)
            {
                c.OnIdleRequestException += ex => OnIdleRequestException(c, ex);
            }
            c.Closing += OnConnectionClosing;
            return(c);
        }