Enum ReadConsistencyStrategy

java.lang.Object
java.lang.Enum<ReadConsistencyStrategy>
com.azure.cosmos.ReadConsistencyStrategy
All Implemented Interfaces:
Serializable, Comparable<ReadConsistencyStrategy>, java.lang.constant.Constable

@Beta(value=V4_69_0, warningText="Preview API - subject to change in non-backwards compatible way") public enum ReadConsistencyStrategy extends Enum<ReadConsistencyStrategy>
Represents the read consistency strategies supported by the Azure Cosmos DB service.

The requested read consistency strategy can be chosen independent of the consistency level provisioned for the database account.

The ReadConsistencyStrategy setting will override whatever ConsistencyLevel is chosen in RequestOptions, CosmosClient or the default consistency level for an account unless ReadConsistencyStrategy `DEFAULT` is used.

NOTE: The ReadConsistencyStrategy is currently only working when using direct mode

  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Use the default read behavior for the consistency level applied to the operation, the client or the account
    Eventual Consistency guarantees that reads will return a subset of writes.
    Will read the latest version - since replication with global strong consistency is synchronous this read consistency strategy ensures that the latest successfully written version across regions is returned.
    Will read the latest committed version from the region in preferred order (which means the read region might have stale data) but this read strategy will return the latest committed version of that region
    Session Consistency guarantees monotonic reads (you never read old data, then new, then old again), monotonic writes (writes are ordered) and read your writes (your writes are immediately visible to your reads) within any single session.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    Returns the enum constant of this type with the specified name.
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • DEFAULT

      public static final ReadConsistencyStrategy DEFAULT
      Use the default read behavior for the consistency level applied to the operation, the client or the account
    • EVENTUAL

      public static final ReadConsistencyStrategy EVENTUAL
      Eventual Consistency guarantees that reads will return a subset of writes. All writes will be eventually be available for reads.
    • SESSION

      public static final ReadConsistencyStrategy SESSION
      Session Consistency guarantees monotonic reads (you never read old data, then new, then old again), monotonic writes (writes are ordered) and read your writes (your writes are immediately visible to your reads) within any single session.
    • LATEST_COMMITTED

      public static final ReadConsistencyStrategy LATEST_COMMITTED
      Will read the latest committed version from the region in preferred order (which means the read region might have stale data) but this read strategy will return the latest committed version of that region
    • GLOBAL_STRONG

      public static final ReadConsistencyStrategy GLOBAL_STRONG
      Will read the latest version - since replication with global strong consistency is synchronous this read consistency strategy ensures that the latest successfully written version across regions is returned. NOTE: Only supported for single-master accounts with Strong consistency enabled as default consistency.
  • Method Details

    • values

      public static ReadConsistencyStrategy[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static ReadConsistencyStrategy valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • toString

      public String toString()
      Overrides:
      toString in class Enum<ReadConsistencyStrategy>