Package org.apache.pulsar.client.api.v5
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 TypeMethodDescriptionstatic Checkpointearliest()A sentinel checkpoint representing the beginning of the topic (oldest available data).static CheckpointfromByteArray(byte[] data) Deserialize a checkpoint from a byte array previously obtained viatoByteArray().static Checkpointlatest()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
A sentinel checkpoint representing the beginning of the topic (oldest available data).- Returns:
- a sentinel
Checkpointrepresenting the earliest position in the topic
-
latest
A sentinel checkpoint representing the end of the topic (next message to be published).- Returns:
- a sentinel
Checkpointrepresenting the latest position in the topic
-
fromByteArray
Deserialize a checkpoint from a byte array previously obtained viatoByteArray().- Parameters:
data- the byte array previously obtained fromtoByteArray()- Returns:
- the deserialized
Checkpoint - Throws:
IOException- if the byte array is malformed or cannot be deserialized
-