Package io.debezium.connector.mongodb
Class MongoDbOffsetContext
- java.lang.Object
-
- io.debezium.connector.mongodb.MongoDbOffsetContext
-
- All Implemented Interfaces:
OffsetContext
public class MongoDbOffsetContext extends Object implements OffsetContext
A context that facilitates the management of the current offsets across a set of mongodb replica sets.- Author:
- Chris Cranford
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMongoDbOffsetContext.Loader
-
Field Summary
Fields Modifier and Type Field Description private IncrementalSnapshotContext<CollectionId>incrementalSnapshotContextprivate Map<ReplicaSet,ReplicaSetOffsetContext>replicaSetOffsetContextsprivate Map<ReplicaSet,ReplicaSetPartition>replicaSetPartitionsprivate SourceInfosourceInfoprivate TransactionContexttransactionContext
-
Constructor Summary
Constructors Constructor Description MongoDbOffsetContext(SourceInfo sourceInfo, TransactionContext transactionContext, IncrementalSnapshotContext<CollectionId> incrementalSnapshotContext)MongoDbOffsetContext(SourceInfo sourceInfo, TransactionContext transactionContext, IncrementalSnapshotContext<CollectionId> incrementalSnapshotContext, Map<ReplicaSet,org.bson.Document> offsets)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidevent(DataCollectionId collectionId, Instant timestamp)IncrementalSnapshotContext<?>getIncrementalSnapshotContext()Map<String,?>getOffset()ReplicaSetOffsetContextgetReplicaSetOffsetContext(ReplicaSet replicaSet)Get aReplicaSetOffsetContextinstance for a givenReplicaSet.ReplicaSetPartitiongetReplicaSetPartition(ReplicaSet replicaSet)Get aReplicaSetPartitioninstance for a givenReplicaSet.org.apache.kafka.connect.data.StructgetSourceInfo()org.apache.kafka.connect.data.SchemagetSourceInfoSchema()TransactionContextgetTransactionContext()voidincrementalSnapshotEvents()booleanisSnapshotRunning()voidmarkLastSnapshotRecord()voidpostSnapshotCompletion()voidpreSnapshotCompletion()voidpreSnapshotStart()(package private) voidstartReplicaSetSnapshot(String replicaSetName)(package private) voidstopReplicaSetSnapshot(String replicaSetName)StringtoString()
-
-
-
Field Detail
-
sourceInfo
private final SourceInfo sourceInfo
-
transactionContext
private final TransactionContext transactionContext
-
replicaSetPartitions
private final Map<ReplicaSet,ReplicaSetPartition> replicaSetPartitions
-
replicaSetOffsetContexts
private final Map<ReplicaSet,ReplicaSetOffsetContext> replicaSetOffsetContexts
-
incrementalSnapshotContext
private final IncrementalSnapshotContext<CollectionId> incrementalSnapshotContext
-
-
Constructor Detail
-
MongoDbOffsetContext
public MongoDbOffsetContext(SourceInfo sourceInfo, TransactionContext transactionContext, IncrementalSnapshotContext<CollectionId> incrementalSnapshotContext)
-
MongoDbOffsetContext
public MongoDbOffsetContext(SourceInfo sourceInfo, TransactionContext transactionContext, IncrementalSnapshotContext<CollectionId> incrementalSnapshotContext, Map<ReplicaSet,org.bson.Document> offsets)
-
-
Method Detail
-
startReplicaSetSnapshot
void startReplicaSetSnapshot(String replicaSetName)
-
stopReplicaSetSnapshot
void stopReplicaSetSnapshot(String replicaSetName)
-
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
-
preSnapshotStart
public void preSnapshotStart()
- Specified by:
preSnapshotStartin interfaceOffsetContext
-
preSnapshotCompletion
public void preSnapshotCompletion()
- Specified by:
preSnapshotCompletionin interfaceOffsetContext
-
postSnapshotCompletion
public void postSnapshotCompletion()
- Specified by:
postSnapshotCompletionin interfaceOffsetContext
-
markLastSnapshotRecord
public void markLastSnapshotRecord()
- Specified by:
markLastSnapshotRecordin interfaceOffsetContext
-
getTransactionContext
public TransactionContext getTransactionContext()
- Specified by:
getTransactionContextin interfaceOffsetContext
-
incrementalSnapshotEvents
public void incrementalSnapshotEvents()
- Specified by:
incrementalSnapshotEventsin interfaceOffsetContext
-
getIncrementalSnapshotContext
public IncrementalSnapshotContext<?> getIncrementalSnapshotContext()
- Specified by:
getIncrementalSnapshotContextin interfaceOffsetContext
-
event
public void event(DataCollectionId collectionId, Instant timestamp)
- Specified by:
eventin interfaceOffsetContext
-
getReplicaSetPartition
public ReplicaSetPartition getReplicaSetPartition(ReplicaSet replicaSet)
Get aReplicaSetPartitioninstance for a givenReplicaSet.- Parameters:
replicaSet- the replica set; must not be null.- Returns:
- a replica set partition; never null.
-
getReplicaSetOffsetContext
public ReplicaSetOffsetContext getReplicaSetOffsetContext(ReplicaSet replicaSet)
Get aReplicaSetOffsetContextinstance for a givenReplicaSet.- Parameters:
replicaSet- the replica set; must not be null.- Returns:
- a replica set offset context; never null.
-
-