Class BaseCosmosDbProperties
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CosmosDbServiceRegistryProperties
,CosmosDbTicketRegistryProperties
BaseCosmosDbProperties
.- Since:
- 5.2.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDocument Db consistency level.Database name.int
The max auto scale throughput.Specifies the supported indexing modes in the Azure Cosmos DB database service.getKey()
Document Db master key.int
Sets the maximum number of retries in the case where the request fails because the service has applied rate limiting on the client.Sets the maximum retry time in seconds.Sets the preferred regions for geo-replicated database accounts.getUri()
Document Db host address (i.e.Sets the value of the user-agent suffix.boolean
Whether telemetry should be enabled by default.boolean
Sets the flag to enable endpoint discovery for geo-replicated database accounts.setAllowTelemetry
(boolean allowTelemetry) Whether telemetry should be enabled by default.setConsistencyLevel
(String consistencyLevel) Document Db consistency level.setDatabase
(String database) Database name.setDatabaseThroughput
(int databaseThroughput) The max auto scale throughput.setEndpointDiscoveryEnabled
(boolean endpointDiscoveryEnabled) Sets the flag to enable endpoint discovery for geo-replicated database accounts.setIndexingMode
(String indexingMode) Specifies the supported indexing modes in the Azure Cosmos DB database service.Document Db master key.setMaxRetryAttemptsOnThrottledRequests
(int maxRetryAttemptsOnThrottledRequests) Sets the maximum number of retries in the case where the request fails because the service has applied rate limiting on the client.setMaxRetryWaitTime
(String maxRetryWaitTime) Sets the maximum retry time in seconds.setPreferredRegions
(List<String> preferredRegions) Sets the preferred regions for geo-replicated database accounts.Document Db host address (i.e.setUserAgentSuffix
(String userAgentSuffix) Sets the value of the user-agent suffix.
-
Constructor Details
-
BaseCosmosDbProperties
public BaseCosmosDbProperties()
-
-
Method Details
-
getUri
Document Db host address (i.e. https://localhost:8081). -
getKey
Document Db master key. -
getConsistencyLevel
Document Db consistency level. Azure Cosmos DB is designed from the ground up with global distribution in mind for every data model. It is designed to offer predictable low latency guarantees, a 99.99% availability SLA, and multiple well-defined relaxed consistency models. Currently, Azure Cosmos DB provides five consistency levels: strong, bounded-staleness, session, consistent prefix, and eventual. Besides strong and eventual consistency models commonly offered by distributed databases, Azure Cosmos DB offers three more carefully codified and operationalized consistency models, and has validated their usefulness against real world use cases. These are the bounded staleness, session, and consistent prefix consistency levels. Collectively these five consistency levels enable you to make well-reasoned trade-offs between consistency, availability, and latency. Accepted values are:STRONG
: LinearizabilitySESSION
: Consistent Prefix. Monotonic reads, monotonic writes, read-your-writes, write-follows-readsEVENTUAL
: Out of order readsBOUNDED_STALENESS
: Consistent Prefix. Reads lag behind writes by k prefixes or t intervalCONSISTENT_PREFIX
: Updates returned are some prefix of all the updates, with no gaps
-
isEndpointDiscoveryEnabled
public boolean isEndpointDiscoveryEnabled()Sets the flag to enable endpoint discovery for geo-replicated database accounts. When EnableEndpointDiscovery is true, the SDK will automatically discover the current write and read regions to ensure requests are sent to the correct region based on the capability of the region and the user's preference. -
getDatabase
Database name. -
getDatabaseThroughput
public int getDatabaseThroughput()The max auto scale throughput. -
isAllowTelemetry
public boolean isAllowTelemetry()Whether telemetry should be enabled by default. Sets the flag to enable client telemetry which will periodically collect database operations aggregation statistics, system information like cpu/memory and send it to cosmos monitoring service, which will be helpful during debugging. -
getPreferredRegions
Sets the preferred regions for geo-replicated database accounts. For example, "East US" as the preferred region. When EnableEndpointDiscovery is true and PreferredRegions is non-empty, the SDK will prefer to use the regions in the container in the order they are specified to perform operations. -
getUserAgentSuffix
Sets the value of the user-agent suffix. -
getMaxRetryAttemptsOnThrottledRequests
public int getMaxRetryAttemptsOnThrottledRequests()Sets the maximum number of retries in the case where the request fails because the service has applied rate limiting on the client.When a client is sending requests faster than the allowed rate, the service will return HttpStatusCode 429 (Too Many Request) to throttle the client. The current implementation in the SDK will then wait for the amount of time the service tells it to wait and retry after the time has elapsed.
The default value is 4. This means in the case where the request is throttled, the same request will be issued for a maximum of 5 times to the server before an error is returned to the application.
-
getMaxRetryWaitTime
Sets the maximum retry time in seconds. When a request fails due to a throttle error, the service sends back a response that contains a value indicating the client should not retry before the time period has elapsed (Retry-After). The MaxRetryWaitTime flag allows the application to set a maximum wait time for all retry attempts. If the cumulative wait time exceeds the MaxRetryWaitTime, the SDK will stop retrying and return the error to the application. -
getIndexingMode
Specifies the supported indexing modes in the Azure Cosmos DB database service. Accepted values are:CONSISTENT
: Index is updated synchronously with a create or update operation. With consistent indexing, query behavior is the same as the default consistency level for the collection. The index is always kept up to date with the data.LAZY
: Index is updated asynchronously with respect to a create or update operation. With lazy indexing, queries are eventually consistent. The index is updated when the collection is idle.NONE
: No index is provided. Setting IndexingMode to "None" drops the index. Use this if you don't want to maintain the index for a document collection, to save the storage cost or improve the write throughput. Your queries will degenerate to scans of the entire collection.
-
setUri
Document Db host address (i.e. https://localhost:8081).- Returns:
this
.
-
setKey
Document Db master key.- Returns:
this
.
-
setConsistencyLevel
Document Db consistency level. Azure Cosmos DB is designed from the ground up with global distribution in mind for every data model. It is designed to offer predictable low latency guarantees, a 99.99% availability SLA, and multiple well-defined relaxed consistency models. Currently, Azure Cosmos DB provides five consistency levels: strong, bounded-staleness, session, consistent prefix, and eventual. Besides strong and eventual consistency models commonly offered by distributed databases, Azure Cosmos DB offers three more carefully codified and operationalized consistency models, and has validated their usefulness against real world use cases. These are the bounded staleness, session, and consistent prefix consistency levels. Collectively these five consistency levels enable you to make well-reasoned trade-offs between consistency, availability, and latency. Accepted values are:STRONG
: LinearizabilitySESSION
: Consistent Prefix. Monotonic reads, monotonic writes, read-your-writes, write-follows-readsEVENTUAL
: Out of order readsBOUNDED_STALENESS
: Consistent Prefix. Reads lag behind writes by k prefixes or t intervalCONSISTENT_PREFIX
: Updates returned are some prefix of all the updates, with no gaps
- Returns:
this
.
-
setEndpointDiscoveryEnabled
Sets the flag to enable endpoint discovery for geo-replicated database accounts. When EnableEndpointDiscovery is true, the SDK will automatically discover the current write and read regions to ensure requests are sent to the correct region based on the capability of the region and the user's preference.- Returns:
this
.
-
setDatabase
Database name.- Returns:
this
.
-
setDatabaseThroughput
The max auto scale throughput.- Returns:
this
.
-
setAllowTelemetry
Whether telemetry should be enabled by default. Sets the flag to enable client telemetry which will periodically collect database operations aggregation statistics, system information like cpu/memory and send it to cosmos monitoring service, which will be helpful during debugging.- Returns:
this
.
-
setPreferredRegions
Sets the preferred regions for geo-replicated database accounts. For example, "East US" as the preferred region. When EnableEndpointDiscovery is true and PreferredRegions is non-empty, the SDK will prefer to use the regions in the container in the order they are specified to perform operations.- Returns:
this
.
-
setUserAgentSuffix
Sets the value of the user-agent suffix.- Returns:
this
.
-
setMaxRetryAttemptsOnThrottledRequests
public BaseCosmosDbProperties setMaxRetryAttemptsOnThrottledRequests(int maxRetryAttemptsOnThrottledRequests) Sets the maximum number of retries in the case where the request fails because the service has applied rate limiting on the client.When a client is sending requests faster than the allowed rate, the service will return HttpStatusCode 429 (Too Many Request) to throttle the client. The current implementation in the SDK will then wait for the amount of time the service tells it to wait and retry after the time has elapsed.
The default value is 4. This means in the case where the request is throttled, the same request will be issued for a maximum of 5 times to the server before an error is returned to the application.
- Returns:
this
.
-
setMaxRetryWaitTime
Sets the maximum retry time in seconds. When a request fails due to a throttle error, the service sends back a response that contains a value indicating the client should not retry before the time period has elapsed (Retry-After). The MaxRetryWaitTime flag allows the application to set a maximum wait time for all retry attempts. If the cumulative wait time exceeds the MaxRetryWaitTime, the SDK will stop retrying and return the error to the application.- Returns:
this
.
-
setIndexingMode
Specifies the supported indexing modes in the Azure Cosmos DB database service. Accepted values are:CONSISTENT
: Index is updated synchronously with a create or update operation. With consistent indexing, query behavior is the same as the default consistency level for the collection. The index is always kept up to date with the data.LAZY
: Index is updated asynchronously with respect to a create or update operation. With lazy indexing, queries are eventually consistent. The index is updated when the collection is idle.NONE
: No index is provided. Setting IndexingMode to "None" drops the index. Use this if you don't want to maintain the index for a document collection, to save the storage cost or improve the write throughput. Your queries will degenerate to scans of the entire collection.
- Returns:
this
.
-