Class CommonOffsetContext<T extends BaseSourceInfo>

java.lang.Object
io.debezium.pipeline.CommonOffsetContext<T>
All Implemented Interfaces:
OffsetContext

public abstract class CommonOffsetContext<T extends BaseSourceInfo> extends Object implements OffsetContext
  • Field Details

    • SNAPSHOT_COMPLETED_KEY

      public static final String SNAPSHOT_COMPLETED_KEY
      See Also:
    • sourceInfo

      protected final T extends BaseSourceInfo sourceInfo
    • snapshot

      protected SnapshotType snapshot
      Indicates the type of in progress snapshot (INITIAL, BLOCKING, INCREMENTAL). In case of an INITIAL or BLOCKING snapshot it will be used in conjunction with snapshotCompleted to define if it is running or not.

      The following table lists the possible status:

      StatussnapshotsnapshotCompleted
      incomplete initial snapshotinitialfalse
      completed initial snapshotnulltrue
      incomplete blocking snapshotblockingfalse
      completed blocking snapshotnulltrue
      running incremental snapshotincrementaltrue
      completed incremental snapshotnulltrue
    • snapshotCompleted

      protected boolean snapshotCompleted
      Whether an initial/blocking snapshot has been completed or not.
  • Constructor Details

    • CommonOffsetContext

      public CommonOffsetContext(T sourceInfo)
    • CommonOffsetContext

      public CommonOffsetContext(T sourceInfo, boolean snapshotCompleted)
  • Method Details

    • getSourceInfo

      public org.apache.kafka.connect.data.Struct getSourceInfo()
      Specified by:
      getSourceInfo in interface OffsetContext
    • markSnapshotRecord

      public void markSnapshotRecord(SnapshotRecord record)
      Description copied from interface: OffsetContext
      Mark the position of the record in the snapshot.
      Specified by:
      markSnapshotRecord in interface OffsetContext
    • isInitialSnapshotRunning

      public boolean isInitialSnapshotRunning()
      Description copied from interface: OffsetContext
      Whether this offset indicates that an (uncompleted) snapshot is currently running or not.
      Specified by:
      isInitialSnapshotRunning in interface OffsetContext
      Returns:
    • preSnapshotStart

      public void preSnapshotStart(boolean onDemand)
      Description copied from interface: OffsetContext
      Signals that a snapshot will begin, which should reflect in an updated offset state.
      Specified by:
      preSnapshotStart in interface OffsetContext
      Parameters:
      onDemand - indicates whether the snapshot is initial or blocking
    • preSnapshotCompletion

      public void preSnapshotCompletion()
      Description copied from interface: OffsetContext
      Signals that a snapshot will complete, which should reflect in an updated offset state.
      Specified by:
      preSnapshotCompletion in interface OffsetContext
    • postSnapshotCompletion

      public void postSnapshotCompletion()
      Description copied from interface: OffsetContext
      Signals that a snapshot has been completed, which should reflect in an updated offset state.
      Specified by:
      postSnapshotCompletion in interface OffsetContext
    • incrementalSnapshotEvents

      public void incrementalSnapshotEvents()
      Description copied from interface: OffsetContext
      Signals that the streaming of a batch of incremental snapshot events will begin, which should reflect in an updated offset state.
      Specified by:
      incrementalSnapshotEvents in interface OffsetContext
    • getSnapshot

      public Optional<SnapshotType> getSnapshot()
    • setSnapshot

      public void setSnapshot(SnapshotType snapshotType)