Package io.debezium.pipeline.spi
Interface OffsetContext
public interface OffsetContext
Keeps track of the current offset within the source DB's change stream. This reflects in the offset as committed to
Kafka and in the source info block contained within CDC messages themselves.
- Author:
- Gunnar Morling
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
OffsetContext.Loader<O extends OffsetContext>
Implementations load a connector-specific offset context based on the offset values stored in Kafka. -
Method Summary
Modifier and TypeMethodDescriptionvoid
event
(DataCollectionId collectionId, Instant timestamp) Records the name of the collection and the timestamp of the last eventdefault IncrementalSnapshotContext<?>
Provide a context used byIncrementalSnapshotChangeEventSource
so persist its internal state into offsets to survive between restarts.org.apache.kafka.connect.data.Struct
org.apache.kafka.connect.data.Schema
Provide a context used byTransactionMonitor
so persist its internal state into offsets to survive between restarts.default void
Signals that the streaming of a batch of incremental snapshot events will begin, which should reflect in an updated offset state.boolean
Whether this offset indicates that an (uncompleted) snapshot is currently running or not.void
mark current record as the last one in the snapshotvoid
Signals that a snapshot has been completed, which should reflect in an updated offset state.void
Signals that a snapshot will complete, which should reflect in an updated offset state.void
Signals that a snapshot will begin, which should reflect in an updated offset state.
-
Method Details
-
getOffset
-
getSourceInfoSchema
org.apache.kafka.connect.data.Schema getSourceInfoSchema() -
getSourceInfo
org.apache.kafka.connect.data.Struct getSourceInfo() -
isSnapshotRunning
boolean isSnapshotRunning()Whether this offset indicates that an (uncompleted) snapshot is currently running or not.- Returns:
-
markLastSnapshotRecord
void markLastSnapshotRecord()mark current record as the last one in the snapshot -
preSnapshotStart
void preSnapshotStart()Signals that a snapshot will begin, which should reflect in an updated offset state. -
preSnapshotCompletion
void preSnapshotCompletion()Signals that a snapshot will complete, which should reflect in an updated offset state. -
postSnapshotCompletion
void postSnapshotCompletion()Signals that a snapshot has been completed, which should reflect in an updated offset state. -
event
Records the name of the collection and the timestamp of the last event -
getTransactionContext
TransactionContext getTransactionContext()Provide a context used byTransactionMonitor
so persist its internal state into offsets to survive between restarts.- Returns:
- transaction context
-
incrementalSnapshotEvents
default void incrementalSnapshotEvents()Signals that the streaming of a batch of incremental snapshot events will begin, which should reflect in an updated offset state. -
getIncrementalSnapshotContext
Provide a context used byIncrementalSnapshotChangeEventSource
so persist its internal state into offsets to survive between restarts.- Returns:
- incremental snapshot context
-