Class SourceRecordJson

java.lang.Object
org.apache.beam.io.debezium.SourceRecordJson

public class SourceRecordJson extends Object
This class can be used as a mapper for each SourceRecord retrieved.

What it does

It maps any SourceRecord retrieved from any supported

invalid reference
io.debezium.connector
to JSON

How it works

It will extract valuable fields from any given SourceRecord:

  • before - loadBefore()
  • after - loadAfter()
  • metadata - loadMetadata()
    • schema - Database Schema
    • connector - Connector used
    • version - Connector version

Usage Example

Map each SourceRecord to JSON

     DebeziumIO.read()
         .withFormatFunction(new SourceRecordJson.SourceRecordJsonMapper()
 
  • Constructor Details

    • SourceRecordJson

      public SourceRecordJson(@Nullable org.apache.kafka.connect.source.SourceRecord sourceRecord)
      Initializer.
      Parameters:
      sourceRecord - retrieved SourceRecord using a supported SourceConnector
  • Method Details

    • toJson

      public String toJson()
      Transforms the extracted data to a JSON string.
      Returns:
      JSON String