Package io.debezium.connector.mongodb
Class ReplicaSetOffsetContext
- java.lang.Object
-
- io.debezium.connector.mongodb.ReplicaSetOffsetContext
-
- All Implemented Interfaces:
OffsetContext
@ThreadSafe public class ReplicaSetOffsetContext extends Object implements OffsetContext
AnOffsetContextimplementation that is specific to a singleReplicaSet. The mongodb connector operates multiple threads during snapshot and streaming modes where eachReplicaSetis processed individually and the offsets that pertain to thatReplicaSetshould 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
Fields Modifier and Type Field Description private MongoDbOffsetContextoffsetContextprivate StringreplicaSetNameprivate SourceInfosourceInfo
-
Constructor Summary
Constructors Constructor Description ReplicaSetOffsetContext(MongoDbOffsetContext offsetContext, ReplicaSet replicaSet, SourceInfo sourceInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidevent(DataCollectionId collectionId, Instant timestamp)Map<String,?>getOffset()StringgetReplicaSetName()org.apache.kafka.connect.data.StructgetSourceInfo()org.apache.kafka.connect.data.SchemagetSourceInfoSchema()TransactionContextgetTransactionContext()booleanhasOffset()booleanisSnapshotOngoing()booleanisSnapshotRunning()org.bson.BsonTimestamplastOffsetTimestamp()OptionalLonglastOffsetTxOrder()voidmarkLastSnapshotRecord()voidoplogEvent(org.bson.Document oplogEvent, org.bson.Document masterEvent, Long txOrder)voidpostSnapshotCompletion()voidpreSnapshotCompletion()voidpreSnapshotStart()voidreadEvent(CollectionId collectionId, Instant timestamp)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.debezium.pipeline.spi.OffsetContext
getIncrementalSnapshotContext, incrementalSnapshotEvents
-
-
-
-
Field Detail
-
offsetContext
private final MongoDbOffsetContext offsetContext
-
replicaSetName
private final String replicaSetName
-
sourceInfo
private final SourceInfo sourceInfo
-
-
Constructor Detail
-
ReplicaSetOffsetContext
public ReplicaSetOffsetContext(MongoDbOffsetContext offsetContext, ReplicaSet replicaSet, SourceInfo sourceInfo)
-
-
Method Detail
-
getOffset
public Map<String,?> 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
public void event(DataCollectionId collectionId, Instant timestamp)
- Specified by:
eventin interfaceOffsetContext
-
getTransactionContext
public TransactionContext getTransactionContext()
- Specified by:
getTransactionContextin interfaceOffsetContext
-
getReplicaSetName
public String getReplicaSetName()
-
isSnapshotOngoing
public boolean isSnapshotOngoing()
-
hasOffset
public boolean hasOffset()
-
readEvent
public void readEvent(CollectionId collectionId, Instant timestamp)
-
oplogEvent
public void oplogEvent(org.bson.Document oplogEvent, org.bson.Document masterEvent, Long txOrder)
-
lastOffsetTimestamp
public org.bson.BsonTimestamp lastOffsetTimestamp()
-
lastOffsetTxOrder
public OptionalLong lastOffsetTxOrder()
-
-