Package io.debezium.data
Class KeyValueStore
java.lang.Object
io.debezium.data.KeyValueStore
A test utility for accumulating the
SourceRecords that represent change events on rows. This store applies the
changes and maintains the current state of the rows.- Author:
- Randall Hauch
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<io.debezium.relational.TableId,KeyValueStore.Collection> private final List<org.apache.kafka.connect.source.SourceRecord> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedKeyValueStore(Function<String, io.debezium.relational.TableId> tableIdFromTopic) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(org.apache.kafka.connect.source.SourceRecord record) collection(io.debezium.relational.TableId tableId) collection(String fullyQualifiedName) collection(String catalog, String tableName) intSet<io.debezium.relational.TableId>static KeyValueStorecreateForTopicsBeginningWith(String prefix) Create a KeyValueStore that removes from the topic names the supplied prefix to obtain theTableId.static KeyValueStorecreateForTopicsMatching(String regex, int groupNumber) Create a KeyValueStore that uses the supplied regular expression and group number to extract theTableIdfrom the topic name.getOrCreate(io.debezium.relational.TableId tableId) protected static org.apache.kafka.connect.data.StructkeyFor(org.apache.kafka.connect.source.SourceRecord record) prefixedWith(String prefix) protected static org.apache.kafka.connect.data.StructsourceFor(org.apache.kafka.connect.source.SourceRecord record) List<org.apache.kafka.connect.source.SourceRecord>protected static org.apache.kafka.connect.data.StructvalueFor(org.apache.kafka.connect.source.SourceRecord record)
-
Field Details
-
sourceRecords
-
collectionsByTableId
-
tableIdFromTopic
-
-
Constructor Details
-
KeyValueStore
-
-
Method Details
-
prefixedWith
-
fromRegex
-
createForTopicsMatching
Create a KeyValueStore that uses the supplied regular expression and group number to extract theTableIdfrom the topic name.- Parameters:
regex- the regular expression that identifies the table ID within the topic name; may not be nullgroupNumber- the group number in the regex for the table ID string- Returns:
- the key value store
-
createForTopicsBeginningWith
Create a KeyValueStore that removes from the topic names the supplied prefix to obtain theTableId.- Parameters:
prefix- the prefix after which all of the topic name forms the table ID; may not be null- Returns:
- the key value store
-
add
public void add(org.apache.kafka.connect.source.SourceRecord record) -
sourceRecords
-
collection
-
collection
-
collection
-
collections
-
databases
-
collectionCount
public int collectionCount() -
getOrCreate
-
keyFor
protected static org.apache.kafka.connect.data.Struct keyFor(org.apache.kafka.connect.source.SourceRecord record) -
valueFor
protected static org.apache.kafka.connect.data.Struct valueFor(org.apache.kafka.connect.source.SourceRecord record) -
sourceFor
protected static org.apache.kafka.connect.data.Struct sourceFor(org.apache.kafka.connect.source.SourceRecord record)
-