Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using connection mode from Cosmos Configuration #4807

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a logging statement to ensure that connectionMode is correctly populated from our config? If there are other means to confirm that, feel free to ignore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of exceptions, we do see client configuration which displays connection mode.
Example: "ConnectionMode":"Direct"
To save time of PR build, I am going to leave it as it is.

{
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
Loading