Package oracle.kv.pubsub

# Enum NoSQLStreamMode

java.lang.Object
java.lang.Enum<NoSQLStreamMode>
oracle.kv.pubsub.NoSQLStreamMode

All Implemented Interfaces:
  `Serializable`, `Comparable<NoSQLStreamMode>`

public enum NoSQLStreamMode extends Enum<NoSQLStreamMode>
Subscription stream mode used to configure the starting point for a NoSQL subscription.

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `FROM_CHECKPOINT`
  Start the stream from the last checkpoint saved in the checkpoint table, using the next available position for shards where the checkpoint position is not available.
  `FROM_EXACT_CHECKPOINT`
  Start the stream from the last checkpoint saved in the checkpoint table, signaling an exception if the checkpoint position is not available.
  `FROM_EXACT_STREAM_POSITION`
  Start the stream from the specified start stream position, signaling an exception if the requested position is not available.
  `FROM_NOW`
  Start the stream from the latest available stream position.
  `FROM_STREAM_POSITION`
  Start the stream from the specified start stream position, using the next available position for shards where the requested position is not available.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static NoSQLStreamMode`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static NoSQLStreamMode[]`
  `values()`
  Returns an array containing the constants of this enum type, in the order they are declared.

  ### Methods inherited from class java.lang.Enum

  `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### FROM_NOW

    public static final NoSQLStreamMode FROM_NOW
    Start the stream from the latest available stream position. Any existing checkpoint or specified start stream position will be ignored.

    Example use case

    A user creates a new table "User" and wants to stream all updates made to that table after the subscription is created. She can configure the subscription with:

         final NoSQLSubscriptionConfig subscriptionConfig =
             new NoSQLSubscriptionConfig.Builder("MyCheckpointTable")
             .setSubscribedTables("User")
             .setStreamMode(NoSQLStreamMode.FROM_NOW)
             .build();

    In order to receive all updates made to the table, the user should create the subscription before any updates are made to the table. If not, updates made to the table before the subscription is created may be missed.

  - ### FROM_EXACT_STREAM_POSITION

    public static final NoSQLStreamMode FROM_EXACT_STREAM_POSITION
    Start the stream from the specified start stream position, signaling an exception if the requested position is not available. Any existing checkpoint will be ignored.

    If the requested start position is not available on the master for any shard, the subscription will fail and the publisher will signal `SubscriptionInsufficientLogException` to the subscriber via `NoSQLSubscriber.onError(java.lang.Throwable)`.

    If the requested start position is later than the currently available position on the master for any shard, then the stream will start from the highest position available on the master for that shard. This situation can happen in unusual cases where the store has performed a hard rollback.

    Example use case

    A user wants to stream all updates made to table "User" starting from a given stream position, and needs to be notified with an exception if the requested stream position is not available. She can configure the subscription with:

         final NoSQLStreamPosition position = ...; // given stream position
         final NoSQLSubscriptionConfig subscriptionConfig =
             new NoSQLSubscriptionConfig.Builder("MyCheckpointTable")
             .setSubscribedTables("User")
             .setStreamMode(NoSQLStreamMode.FROM_EXACT_STREAM_POSITION)
             .setStartStreamPosition(position)
             .build();

  - ### FROM_STREAM_POSITION

    public static final NoSQLStreamMode FROM_STREAM_POSITION
    Start the stream from the specified start stream position, using the next available position for shards where the requested position is not available. Any existing checkpoint will be ignored.

    This mode is the same as `FROM_EXACT_STREAM_POSITION` except that the stream will start from the next position available on the master rather than signaling an exception for any shards where the requested start position is not available.

    If the requested start position is later than the currently available position on the master for any shard, then the stream will start from the highest position available on the master for that shard. This situation can happen in unusual cases where the store has performed a hard rollback.

    Example use case

    A user wants to stream all updates made to table "User" starting from a given stream position, but can tolerate missing updates if the requested stream position is not available. She can configure the subscription with:

         final NoSQLStreamPosition position = ...; // given stream position
         final NoSQLSubscriptionConfig subscriptionConfig =
             new NoSQLSubscriptionConfig.Builder("MyCheckpointTable")
             .setSubscribedTables("User")
             .setStreamMode(NoSQLStreamMode.FROM_STREAM_POSITION)
             .setStartStreamPosition(position)
             .build();

  - ### FROM_EXACT_CHECKPOINT

    public static final NoSQLStreamMode FROM_EXACT_CHECKPOINT
    Start the stream from the last checkpoint saved in the checkpoint table, signaling an exception if the checkpoint position is not available. Any specified start stream position will be ignored.

    If the checkpoint table does not exist and the publisher is allowed to create a new checkpoint table for the user, as specified by `NoSQLSubscriptionConfig.Builder.setCreateNewCheckpointTable(boolean)`, then the checkpoint table will be created and the stream will start from the latest position available on the master for each shard. If the checkpoint table does not exist and the publisher is not allowed to create a new checkpoint table, the subscription will fail and the publisher will signal `SubscriptionFailureException` to the subscriber via `NoSQLSubscriber.onError(java.lang.Throwable)`.

    If the checkpoint position is not available on the master for any shard, the subscription will fail and the publisher will signal `SubscriptionInsufficientLogException` to the subscriber via `NoSQLSubscriber.onError(java.lang.Throwable)`.

    If the checkpoint position is later than the currently available position on the master for any shard, then the stream will start from the highest position available on the master for that shard. This situation can happen in unusual cases where the store has performed a hard rollback.

    Example use case

    A user wants to stream all updates made to table "User" from the last checkpoint, and needs to be notified with an exception if the checkpoint position is not available. She can configure the subscription with:

         final NoSQLSubscriptionConfig subscriptionConfig =
             new NoSQLSubscriptionConfig.Builder("MyCheckpointTable")
             .setSubscribedTables("User")
             .setStreamMode(NoSQLStreamMode.FROM_EXACT_CHECKPOINT)
             .build();

  - ### FROM_CHECKPOINT

    public static final NoSQLStreamMode FROM_CHECKPOINT
    Start the stream from the last checkpoint saved in the checkpoint table, using the next available position for shards where the checkpoint position is not available. Any specified start stream position will be ignored.

    This mode is same as `FROM_EXACT_CHECKPOINT` except that the stream will start from the next position available on the master rather than signaling an exception for any shards where the checkpoint position is not available.

    If the checkpoint start position is later than the currently available position on the master for any shard, then the stream will start from the highest position available on the master for that shard. This situation can happen in unusual cases where the store has performed a hard rollback.

    Example use case

    A user wants to stream all updates made to table "User" from the latest saved checkpoint, but can tolerate missing updates if the checkpoint stream position is not available. She can configure the subscription with:

         final NoSQLSubscriptionConfig subscriptionConfig =
             new NoSQLSubscriptionConfig.Builder("MyCheckpointTable")
             .setSubscribedTables("User")
             .setStreamMode(NoSQLStreamMode.FROM_CHECKPOINT)
             .build();

- ## Method Details

  - ### values

    public static NoSQLStreamMode[] 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 NoSQLStreamMode 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