Skip to content

Commit 1f585f7

Browse files
ConnectionMode is fetched from configuration instead of using Direct mode always (#4807)
1 parent 0932788 commit 1f585f7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Microsoft.Health.Fhir.CosmosDb/Features/Storage/FhirCosmosClientInitializer.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,16 @@ private CosmosClient CreateCosmosClientInternal(CosmosDataStoreConfiguration con
131131
new CosmosClientBuilder(host, _cosmosAccessTokenProviderFactory.Invoke().TokenCredential) :
132132
new CosmosClientBuilder(host, key);
133133

134+
if (configuration.ConnectionMode == ConnectionMode.Gateway)
135+
{
136+
builder.WithConnectionModeGateway();
137+
}
138+
else
139+
{
140+
builder.WithConnectionModeDirect(enableTcpConnectionEndpointRediscovery: true);
141+
}
142+
134143
builder
135-
.WithConnectionModeDirect(enableTcpConnectionEndpointRediscovery: true)
136144
.WithCustomSerializer(new FhirCosmosSerializer(_logger))
137145
.WithThrottlingRetryOptions(TimeSpan.FromSeconds(configuration.RetryOptions.MaxWaitTimeInSeconds), configuration.RetryOptions.MaxNumberOfRetries)
138146
.AddCustomHandlers(requestHandlers.ToArray());

0 commit comments

Comments
 (0)