Skip to content

Commit

Permalink
ConnectionMode is fetched from configuration instead of using Direct …
Browse files Browse the repository at this point in the history
…mode always (#4807)
  • Loading branch information
rajithaalurims authored Jan 29, 2025
1 parent 0932788 commit 1f585f7
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,16 @@ private CosmosClient CreateCosmosClientInternal(CosmosDataStoreConfiguration con
new CosmosClientBuilder(host, _cosmosAccessTokenProviderFactory.Invoke().TokenCredential) :
new CosmosClientBuilder(host, key);

if (configuration.ConnectionMode == ConnectionMode.Gateway)
{
builder.WithConnectionModeGateway();
}
else
{
builder.WithConnectionModeDirect(enableTcpConnectionEndpointRediscovery: true);
}

builder
.WithConnectionModeDirect(enableTcpConnectionEndpointRediscovery: true)
.WithCustomSerializer(new FhirCosmosSerializer(_logger))
.WithThrottlingRetryOptions(TimeSpan.FromSeconds(configuration.RetryOptions.MaxWaitTimeInSeconds), configuration.RetryOptions.MaxNumberOfRetries)
.AddCustomHandlers(requestHandlers.ToArray());
Expand Down

0 comments on commit 1f585f7

Please sign in to comment.