Package io.debezium.connector.mongodb
Class ReplicaSetOffsetContext
java.lang.Object
io.debezium.connector.mongodb.ReplicaSetOffsetContext
- All Implemented Interfaces:
OffsetContext
An
OffsetContext implementation that is specific to a single ReplicaSet.
The mongodb connector operates multiple threads during snapshot and streaming modes where each ReplicaSet
is processed individually and the offsets that pertain to that ReplicaSet should be maintained in such a
way that is considered thread-safe. This implementation offers such safety.- Author:
- Chris Cranford
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.debezium.pipeline.spi.OffsetContext
OffsetContext.Loader<O extends OffsetContext> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IncrementalSnapshotContext<CollectionId>private final MongoDbOffsetContextprivate final Stringprivate final SourceInfo -
Constructor Summary
ConstructorsConstructorDescriptionReplicaSetOffsetContext(MongoDbOffsetContext offsetContext, ReplicaSet replicaSet, SourceInfo sourceInfo, IncrementalSnapshotContext<CollectionId> incrementalSnapshotContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeStreamEvent(com.mongodb.client.model.changestream.ChangeStreamDocument<org.bson.Document> changeStreamEvent, OptionalLong txOrder) voidevent(DataCollectionId collectionId, Instant timestamp) org.apache.kafka.connect.data.Structorg.apache.kafka.connect.data.Schemabooleanvoidbooleanbooleanbooleanbooleanorg.bson.BsonTimestampvoidvoidoplogEvent(org.bson.Document oplogEvent, org.bson.Document masterEvent, Long txOrder) voidvoidvoidvoidreadEvent(CollectionId collectionId, Instant timestamp)
-
Field Details
-
offsetContext
-
replicaSetName
-
sourceInfo
-
incrementalSnapshotContext
-
-
Constructor Details
-
ReplicaSetOffsetContext
public ReplicaSetOffsetContext(MongoDbOffsetContext offsetContext, ReplicaSet replicaSet, SourceInfo sourceInfo, IncrementalSnapshotContext<CollectionId> incrementalSnapshotContext)
-
-
Method Details
-
getOffset
- Specified by:
getOffsetin interfaceOffsetContext
-
getSourceInfoSchema
public org.apache.kafka.connect.data.Schema getSourceInfoSchema()- Specified by:
getSourceInfoSchemain interfaceOffsetContext
-
getSourceInfo
public org.apache.kafka.connect.data.Struct getSourceInfo()- Specified by:
getSourceInfoin interfaceOffsetContext
-
isSnapshotRunning
public boolean isSnapshotRunning()- Specified by:
isSnapshotRunningin interfaceOffsetContext
-
markLastSnapshotRecord
public void markLastSnapshotRecord()- Specified by:
markLastSnapshotRecordin interfaceOffsetContext
-
preSnapshotStart
public void preSnapshotStart()- Specified by:
preSnapshotStartin interfaceOffsetContext
-
preSnapshotCompletion
public void preSnapshotCompletion()- Specified by:
preSnapshotCompletionin interfaceOffsetContext
-
postSnapshotCompletion
public void postSnapshotCompletion()- Specified by:
postSnapshotCompletionin interfaceOffsetContext
-
event
- Specified by:
eventin interfaceOffsetContext
-
getTransactionContext
- Specified by:
getTransactionContextin interfaceOffsetContext
-
getReplicaSetName
-
isSnapshotOngoing
public boolean isSnapshotOngoing() -
hasOffset
public boolean hasOffset() -
readEvent
-
oplogEvent
-
changeStreamEvent
public void changeStreamEvent(com.mongodb.client.model.changestream.ChangeStreamDocument<org.bson.Document> changeStreamEvent, OptionalLong txOrder) -
lastOffsetTimestamp
public org.bson.BsonTimestamp lastOffsetTimestamp() -
lastOffsetTxOrder
-
lastResumeToken
-
isFromOplog
public boolean isFromOplog() -
isFromChangeStream
public boolean isFromChangeStream() -
incrementalSnapshotEvents
public void incrementalSnapshotEvents()- Specified by:
incrementalSnapshotEventsin interfaceOffsetContext
-
getIncrementalSnapshotContext
- Specified by:
getIncrementalSnapshotContextin interfaceOffsetContext
-