Share via


ConnectionPolicy interface

Represents the Connection policy associated with a CosmosClient in the Azure Cosmos DB database service.

Properties

connectionMode

Determines which mode to connect to Cosmos with. (Currently only supports Gateway option)

enableBackgroundEndpointRefreshing

Flag to enable/disable background refreshing of endpoints. Defaults to true. Endpoint discovery using enableEndpointsDiscovery will still work for failed requests.

enableEndpointDiscovery

Flag to enable/disable automatic redirecting of requests based on read/write operations. Default true. Required to call client.dispose() when this is set to true after destroying the CosmosClient inside another process or in the browser.

enablePartitionLevelCircuitBreaker

Flag to enable/disable Per Partition Level Circuit Breaker (PPCB). Defaults to false. Note: Requires enableEndpointDiscovery to be true. If endpoint discovery is disabled, this setting has no effect.

enablePartitionLevelFailover

Flag to enable/disable Per Partition Level Failover (PPAF). Defaults to true. Automatically failovers to other available partitions when a partition becomes unavailable. When enabled, enablePartitionLevelCircuitBreaker will also be set to true. Note: Dynamic enablement requires both enableEndpointDiscovery and enableBackgroundEndpointRefreshing to be true. If endpoint discovery is disabled, this setting has no effect.

endpointRefreshRateInMs

Rate in milliseconds at which the client will refresh the endpoints list in the background

preferredLocations

List of azure regions to be used as preferred locations for read requests.

requestTimeout

Request timeout (time to wait for response from network peer). Represented in milliseconds.

retryOptions

RetryOptions object which defines several configurable properties used during retry.

useMultipleWriteLocations

The flag that enables writes on any locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service. Default is true.

Property Details

connectionMode

Determines which mode to connect to Cosmos with. (Currently only supports Gateway option)

connectionMode?: Gateway

Property Value

enableBackgroundEndpointRefreshing

Flag to enable/disable background refreshing of endpoints. Defaults to true. Endpoint discovery using enableEndpointsDiscovery will still work for failed requests.

enableBackgroundEndpointRefreshing?: boolean

Property Value

boolean

enableEndpointDiscovery

Flag to enable/disable automatic redirecting of requests based on read/write operations. Default true. Required to call client.dispose() when this is set to true after destroying the CosmosClient inside another process or in the browser.

enableEndpointDiscovery?: boolean

Property Value

boolean

enablePartitionLevelCircuitBreaker

Flag to enable/disable Per Partition Level Circuit Breaker (PPCB). Defaults to false. Note: Requires enableEndpointDiscovery to be true. If endpoint discovery is disabled, this setting has no effect.

enablePartitionLevelCircuitBreaker?: boolean

Property Value

boolean

enablePartitionLevelFailover

Flag to enable/disable Per Partition Level Failover (PPAF). Defaults to true. Automatically failovers to other available partitions when a partition becomes unavailable. When enabled, enablePartitionLevelCircuitBreaker will also be set to true. Note: Dynamic enablement requires both enableEndpointDiscovery and enableBackgroundEndpointRefreshing to be true. If endpoint discovery is disabled, this setting has no effect.

enablePartitionLevelFailover?: boolean

Property Value

boolean

endpointRefreshRateInMs

Rate in milliseconds at which the client will refresh the endpoints list in the background

endpointRefreshRateInMs?: number

Property Value

number

preferredLocations

List of azure regions to be used as preferred locations for read requests.

preferredLocations?: string[]

Property Value

string[]

requestTimeout

Request timeout (time to wait for response from network peer). Represented in milliseconds.

requestTimeout?: number

Property Value

number

retryOptions

RetryOptions object which defines several configurable properties used during retry.

retryOptions?: RetryOptions

Property Value

useMultipleWriteLocations

The flag that enables writes on any locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service. Default is true.

useMultipleWriteLocations?: boolean

Property Value

boolean