예제 #1
0
        /// <inheritdoc />
        public async Task <IBlobStoreHttpClient> CreateBlobStoreHttpClientAsync(Context context)
        {
            var client = BlobStoreHttpClientFactory.GetClient(_backingStoreBaseUri, _httpClientFactory);
            await ArtifactHttpClientErrorDetectionStrategy.ExecuteAsync(
                context,
                "VerifyBlobStoreHttpClientConnection",
                () => _httpClientFactory.VerifyConnectionAsync(client),
                CancellationToken.None).ConfigureAwait(false);

            context.TraceMessage(
                Severity.Debug, $"Verified connection to {_backingStoreBaseUri} with SessionId=[{_httpClientFactory.ClientSettings.SessionId}]");
            return(client);
        }
        private async Task <IBlobStoreHttpClient> CreateDomainBlobStoreHttpClientAsync(Context context)
        {
            var client = BlobStoreHttpClientFactory.GetDomainClient(_backingStoreBaseUri, _httpClientFactory);
            await ArtifactHttpClientErrorDetectionStrategy.ExecuteAsync(
                context,
                "VerifyDomainBlobStoreHttpClientConnection",
                () => _httpClientFactory.VerifyConnectionAsync(client),
                CancellationToken.None).ConfigureAwait(false);

            _tracer.Debug(context, $"Verified connection to {_backingStoreBaseUri} with SessionId=[{_httpClientFactory.ClientSettings.SessionId}], Domain=[{_domain.Serialize()}]");

            return(new DomainBlobHttpClientWrapper(_domain, client));
        }
        /// <inheritdoc />
        public async Task <IBlobStoreHttpClient> CreateBlobStoreHttpClientAsync(Context context)
        {
            if (_domain.Equals(WellKnownDomainIds.DefaultDomainId))
            {
                var client = BlobStoreHttpClientFactory.GetClient(_backingStoreBaseUri, _httpClientFactory);
                await ArtifactHttpClientErrorDetectionStrategy.ExecuteAsync(
                    context,
                    "VerifyBlobStoreHttpClientConnection",
                    () => _httpClientFactory.VerifyConnectionAsync(client),
                    CancellationToken.None).ConfigureAwait(false);

                _tracer.Debug(context, $"Verified connection to {_backingStoreBaseUri} with SessionId=[{_httpClientFactory.ClientSettings.SessionId}], Domain=[Default]");
                return(client);
            }

            return(await CreateDomainBlobStoreHttpClientAsync(context));
        }