Class StartPosition

java.lang.Object
io.github.flink.gcp.connector.base.source.StartPosition
All Implemented Interfaces:
Serializable

@Public public final class StartPosition extends Object implements Serializable
Where a change-stream source starts reading when no checkpointed state is restored.

A configured position applies only to a fresh start. On restore, the source resumes from its checkpointed per-partition positions instead. A source resolves this value once, when its split enumerator starts, and validates it against the stream's retained history.

latest() starts at the resolution instant and is the default used by change-stream source builders. earliest() starts at the oldest safely readable instant reported by the source. at(Instant) names an absolute instant, and ago(Duration) names an instant relative to resolution time.

See Also:
  • Method Details

    • earliest

      public static StartPosition earliest()
      Returns a position at the oldest instant the change stream can safely serve.
    • latest

      public static StartPosition latest()
      Returns a position at the instant the source enumerator starts.
    • at

      public static StartPosition at(Instant instant)
      Returns a position at an absolute instant.
      Parameters:
      instant - the instant to start reading at
      Returns:
      the start position
    • ago

      public static StartPosition ago(Duration duration)
      Returns a position the given duration before the source enumerator starts.
      Parameters:
      duration - how far before startup to begin; must be positive
      Returns:
      the start position
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object