@ThreadSafe public class ReplicaSetOffsetContext extends Object implements OffsetContext
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.OffsetContext.Loader| Modifier and Type | Field and Description |
|---|---|
private MongoDbOffsetContext |
offsetContext |
private String |
replicaSetName |
private SourceInfo |
sourceInfo |
| Constructor and Description |
|---|
ReplicaSetOffsetContext(MongoDbOffsetContext offsetContext,
ReplicaSet replicaSet,
SourceInfo sourceInfo) |
| Modifier and Type | Method and Description |
|---|---|
void |
event(DataCollectionId collectionId,
Instant timestamp) |
Map<String,?> |
getOffset() |
Map<String,?> |
getPartition() |
String |
getReplicaSetName() |
org.apache.kafka.connect.data.Struct |
getSourceInfo() |
org.apache.kafka.connect.data.Schema |
getSourceInfoSchema() |
TransactionContext |
getTransactionContext() |
boolean |
hasOffset() |
boolean |
isSnapshotOngoing() |
boolean |
isSnapshotRunning() |
org.bson.BsonTimestamp |
lastOffsetTimestamp() |
OptionalLong |
lastOffsetTxOrder() |
void |
markLastSnapshotRecord() |
void |
oplogEvent(org.bson.Document oplogEvent,
org.bson.Document masterEvent,
Long txOrder) |
void |
postSnapshotCompletion() |
void |
preSnapshotCompletion() |
void |
preSnapshotStart() |
void |
readEvent(CollectionId collectionId,
Instant timestamp) |
private final MongoDbOffsetContext offsetContext
private final String replicaSetName
private final SourceInfo sourceInfo
public ReplicaSetOffsetContext(MongoDbOffsetContext offsetContext, ReplicaSet replicaSet, SourceInfo sourceInfo)
public Map<String,?> getPartition()
getPartition in interface OffsetContextpublic Map<String,?> getOffset()
getOffset in interface OffsetContextpublic org.apache.kafka.connect.data.Schema getSourceInfoSchema()
getSourceInfoSchema in interface OffsetContextpublic org.apache.kafka.connect.data.Struct getSourceInfo()
getSourceInfo in interface OffsetContextpublic boolean isSnapshotRunning()
isSnapshotRunning in interface OffsetContextpublic void markLastSnapshotRecord()
markLastSnapshotRecord in interface OffsetContextpublic void preSnapshotStart()
preSnapshotStart in interface OffsetContextpublic void preSnapshotCompletion()
preSnapshotCompletion in interface OffsetContextpublic void postSnapshotCompletion()
postSnapshotCompletion in interface OffsetContextpublic void event(DataCollectionId collectionId, Instant timestamp)
event in interface OffsetContextpublic TransactionContext getTransactionContext()
getTransactionContext in interface OffsetContextpublic String getReplicaSetName()
public boolean isSnapshotOngoing()
public boolean hasOffset()
public void readEvent(CollectionId collectionId, Instant timestamp)
public void oplogEvent(org.bson.Document oplogEvent,
org.bson.Document masterEvent,
Long txOrder)
public org.bson.BsonTimestamp lastOffsetTimestamp()
public OptionalLong lastOffsetTxOrder()
Copyright © 2020 JBoss by Red Hat. All rights reserved.