Interface Checkpoint


public interface Checkpoint
An opaque, serializable position vector representing a consistent point across all internal hash-range segments of a topic.

Checkpoints are created via CheckpointConsumer.checkpoint() and can be serialized for external storage (e.g. Flink state, S3) using toByteArray().

This is the sole position type used with CheckpointConsumer — for initial positioning use the static factories earliest(), latest(), or fromByteArray(byte[]) to restore from a previously saved checkpoint.

For timestamp-based positioning, use the scalable-topics seek admin operation on the subscription instead — see

invalid reference
org.apache.pulsar.client.admin.ScalableTopics#seekSubscription
.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Checkpoint
    A sentinel checkpoint representing the beginning of the topic (oldest available data).
    static Checkpoint
    fromByteArray(byte[] data)
    Deserialize a checkpoint from a byte array previously obtained via toByteArray().
    static Checkpoint
    A sentinel checkpoint representing the end of the topic (next message to be published).
    byte[]
    Serialize this checkpoint for external storage.
  • Method Details

    • toByteArray

      byte[] toByteArray()
      Serialize this checkpoint for external storage.
      Returns:
      a serializable byte representation of this checkpoint that can be restored via fromByteArray(byte[])
    • earliest

      static Checkpoint earliest()
      A sentinel checkpoint representing the beginning of the topic (oldest available data).
      Returns:
      a sentinel Checkpoint representing the earliest position in the topic
    • latest

      static Checkpoint latest()
      A sentinel checkpoint representing the end of the topic (next message to be published).
      Returns:
      a sentinel Checkpoint representing the latest position in the topic
    • fromByteArray

      static Checkpoint fromByteArray(byte[] data) throws IOException
      Deserialize a checkpoint from a byte array previously obtained via toByteArray().
      Parameters:
      data - the byte array previously obtained from toByteArray()
      Returns:
      the deserialized Checkpoint
      Throws:
      IOException - if the byte array is malformed or cannot be deserialized