Package io.debezium.pipeline.txmetadata
Class TransactionContext
- java.lang.Object
-
- io.debezium.pipeline.txmetadata.TransactionContext
-
@NotThreadSafe public class TransactionContext extends Object
The context holds internal state necessary for book-keeping of events in active transaction. The main data tracked are- active transaction id
- the total event number seen from the transaction
- the number of events per table/collection seen in the transaction
- Author:
- Jiri Pechanec
-
-
Field Summary
Fields Modifier and Type Field Description private static StringOFFSET_TABLE_COUNT_PREFIXprivate static intOFFSET_TABLE_COUNT_PREFIX_LENGTHprivate static StringOFFSET_TRANSACTION_IDprivate Map<String,Long>perTableEventCountprivate longtotalEventCountprivate StringtransactionIdprivate Map<String,Long>viewPerTableEventCount
-
Constructor Summary
Constructors Constructor Description TransactionContext()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeginTransaction(String txId)voidendTransaction()longevent(DataCollectionId source)Map<String,Long>getPerTableEventCount()longgetTotalEventCount()StringgetTransactionId()booleanisTransactionInProgress()static TransactionContextload(Map<String,?> offsets)private voidreset()Map<String,Object>store(Map<String,Object> offset)StringtoString()
-
-
-
Field Detail
-
OFFSET_TRANSACTION_ID
private static final String OFFSET_TRANSACTION_ID
- See Also:
- Constant Field Values
-
OFFSET_TABLE_COUNT_PREFIX
private static final String OFFSET_TABLE_COUNT_PREFIX
- See Also:
- Constant Field Values
-
OFFSET_TABLE_COUNT_PREFIX_LENGTH
private static final int OFFSET_TABLE_COUNT_PREFIX_LENGTH
-
transactionId
private String transactionId
-
totalEventCount
private long totalEventCount
-
-
Method Detail
-
reset
private void reset()
-
load
public static TransactionContext load(Map<String,?> offsets)
-
isTransactionInProgress
public boolean isTransactionInProgress()
-
getTransactionId
public String getTransactionId()
-
getTotalEventCount
public long getTotalEventCount()
-
beginTransaction
public void beginTransaction(String txId)
-
endTransaction
public void endTransaction()
-
event
public long event(DataCollectionId source)
-
-