Class BaseCosmosDbProperties

java.lang.Object
org.apereo.cas.configuration.model.support.cosmosdb.BaseCosmosDbProperties
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CosmosDbServiceRegistryProperties, CosmosDbTicketRegistryProperties

@RequiresModule(name="cas-server-support-cosmosdb-core") public abstract class BaseCosmosDbProperties extends Object implements Serializable
Since:
5.2.0
See Also:
  • Constructor Details

    • BaseCosmosDbProperties

      public BaseCosmosDbProperties()
  • Method Details

    • getUri

      public String getUri()
      Document Db host address (i.e. https://localhost:8081).
    • getKey

      public String getKey()
      Document Db master key.
    • getConsistencyLevel

      public String 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: Linearizability
      • SESSION: Consistent Prefix. Monotonic reads, monotonic writes, read-your-writes, write-follows-reads
      • EVENTUAL: Out of order reads
      • BOUNDED_STALENESS: Consistent Prefix. Reads lag behind writes by k prefixes or t interval
      • CONSISTENT_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

      public String 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

      public List<String> 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

      public String 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

      public String 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

      public String 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

      public BaseCosmosDbProperties setUri(String uri)
      Document Db host address (i.e. https://localhost:8081).
      Returns:
      this.
    • setKey

      public BaseCosmosDbProperties setKey(String key)
      Document Db master key.
      Returns:
      this.
    • setConsistencyLevel

      public BaseCosmosDbProperties setConsistencyLevel(String consistencyLevel)
      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: Linearizability
      • SESSION: Consistent Prefix. Monotonic reads, monotonic writes, read-your-writes, write-follows-reads
      • EVENTUAL: Out of order reads
      • BOUNDED_STALENESS: Consistent Prefix. Reads lag behind writes by k prefixes or t interval
      • CONSISTENT_PREFIX: Updates returned are some prefix of all the updates, with no gaps
      Returns:
      this.
    • setEndpointDiscoveryEnabled

      public BaseCosmosDbProperties setEndpointDiscoveryEnabled(boolean endpointDiscoveryEnabled)
      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

      public BaseCosmosDbProperties setDatabase(String database)
      Database name.
      Returns:
      this.
    • setDatabaseThroughput

      public BaseCosmosDbProperties setDatabaseThroughput(int databaseThroughput)
      The max auto scale throughput.
      Returns:
      this.
    • setAllowTelemetry

      public BaseCosmosDbProperties setAllowTelemetry(boolean allowTelemetry)
      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

      public BaseCosmosDbProperties setPreferredRegions(List<String> preferredRegions)
      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

      public BaseCosmosDbProperties setUserAgentSuffix(String userAgentSuffix)
      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

      public BaseCosmosDbProperties setMaxRetryWaitTime(String maxRetryWaitTime)
      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

      public BaseCosmosDbProperties setIndexingMode(String indexingMode)
      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.