Package io.debezium.converters
Class RecordParser
- java.lang.Object
-
- io.debezium.converters.RecordParser
-
- Direct Known Subclasses:
RecordParser.MongodbRecordParser,RecordParser.MysqlRecordParser,RecordParser.PostgresRecordParser,RecordParser.SqlserverRecordParser
public abstract class RecordParser extends Object
An abstract parser of change records. Callerscreatea concrete parser for a record and the parser's type is chosen by the connector type (e.g. mysql, postgresql, etc.) defined in change records. Fields and metadata of change records can be provided by RecordParser.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRecordParser.MongodbRecordParserParser for records produced by MongoDB connectors.static classRecordParser.MysqlRecordParserParser for records produced by MySQL connectors.static classRecordParser.PostgresRecordParserParser for records produced by PostgreSQL connectors.static classRecordParser.SqlserverRecordParserParser for records produced by Sql Server connectors.
-
Field Summary
Fields Modifier and Type Field Description private StringconnectorTypeprivate org.apache.kafka.connect.data.SchemadataSchemaprivate Stringopprivate org.apache.kafka.connect.data.SchemaopSchemaprivate org.apache.kafka.connect.data.Structrecordprivate org.apache.kafka.connect.data.Structsource(package private) static Set<String>SOURCE_FIELDSprivate org.apache.kafka.connect.data.Structtransactionprivate Stringts_msprivate org.apache.kafka.connect.data.Schemats_msSchema
-
Constructor Summary
Constructors Modifier Constructor Description protectedRecordParser(org.apache.kafka.connect.data.Schema schema, org.apache.kafka.connect.data.Struct record, String... dataFields)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringconnectorType()Get the type of the connector which produced this record .static RecordParsercreate(org.apache.kafka.connect.data.Schema schema, Object value)Create a concrete parser of a change record for a specific connector type.org.apache.kafka.connect.data.Structdata()Get the value of the data field in the record; may not be null.org.apache.kafka.connect.data.SchemadataSchema()Get the schema of the data field in the record; may be not be null.private static org.apache.kafka.connect.data.SchemagetDataSchema(org.apache.kafka.connect.data.Schema schema, String connectorType, String... fields)abstract ObjectgetMetadata(String name)Search for metadata of the record by name, which are defined in the source field; throw a DataException if not found.Stringop()Get the value of the op field in the record.org.apache.kafka.connect.data.SchemaopSchema()Get the schema of the op field in the record.org.apache.kafka.connect.data.Structsource()Get the value of the source field in the record.org.apache.kafka.connect.data.Structtransaction()Get the value of the transaction field in the record.Stringts_ms()Get the value of the ts_ms field in the record.org.apache.kafka.connect.data.Schemats_msSchema()Get the schema of the ts_ms field in the record.
-
-
-
Field Detail
-
record
private final org.apache.kafka.connect.data.Struct record
-
source
private final org.apache.kafka.connect.data.Struct source
-
transaction
private final org.apache.kafka.connect.data.Struct transaction
-
op
private final String op
-
opSchema
private final org.apache.kafka.connect.data.Schema opSchema
-
ts_ms
private final String ts_ms
-
ts_msSchema
private final org.apache.kafka.connect.data.Schema ts_msSchema
-
dataSchema
private final org.apache.kafka.connect.data.Schema dataSchema
-
connectorType
private final String connectorType
-
-
Constructor Detail
-
RecordParser
protected RecordParser(org.apache.kafka.connect.data.Schema schema, org.apache.kafka.connect.data.Struct record, String... dataFields)
-
-
Method Detail
-
create
public static RecordParser create(org.apache.kafka.connect.data.Schema schema, Object value)
Create a concrete parser of a change record for a specific connector type.- Parameters:
schema- the schema of the recordvalue- the value of the record- Returns:
- a concrete parser
-
getDataSchema
private static org.apache.kafka.connect.data.Schema getDataSchema(org.apache.kafka.connect.data.Schema schema, String connectorType, String... fields)
-
data
public org.apache.kafka.connect.data.Struct data()
Get the value of the data field in the record; may not be null.
-
source
public org.apache.kafka.connect.data.Struct source()
Get the value of the source field in the record.- Returns:
- the value of the source field
-
transaction
public org.apache.kafka.connect.data.Struct transaction()
Get the value of the transaction field in the record.- Returns:
- the value of the transaction field
-
op
public String op()
Get the value of the op field in the record.- Returns:
- the value of the op field
-
opSchema
public org.apache.kafka.connect.data.Schema opSchema()
Get the schema of the op field in the record.- Returns:
- the schema of the op field
-
ts_ms
public String ts_ms()
Get the value of the ts_ms field in the record.- Returns:
- the value of the ts_ms field
-
ts_msSchema
public org.apache.kafka.connect.data.Schema ts_msSchema()
Get the schema of the ts_ms field in the record.- Returns:
- the schema of the ts_ms field
-
dataSchema
public org.apache.kafka.connect.data.Schema dataSchema()
Get the schema of the data field in the record; may be not be null.
-
connectorType
public String connectorType()
Get the type of the connector which produced this record .- Returns:
- the connector type
-
-