Class RelationalChangeRecordEmitter<P extends io.debezium.pipeline.spi.Partition>

  • All Implemented Interfaces:
    io.debezium.pipeline.spi.ChangeRecordEmitter<P>
    Direct Known Subclasses:
    io.debezium.connector.oracle.BaseChangeRecordEmitter

    public abstract class RelationalChangeRecordEmitter<P extends io.debezium.pipeline.spi.Partition>
    extends io.debezium.pipeline.AbstractChangeRecordEmitter<P,​io.debezium.relational.TableSchema>
    Copied from Debezium 1.9.8.Final.

    Base class for ChangeRecordEmitter implementations based on a relational database.

    This class overrides the emit methods to put some values in the header.

    Line 59 ~ 257: add other headers and emit.

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface io.debezium.pipeline.spi.ChangeRecordEmitter

        io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P extends io.debezium.pipeline.spi.Partition>
    • Constructor Summary

      Constructors 
      Constructor Description
      RelationalChangeRecordEmitter​(P partition, io.debezium.pipeline.spi.OffsetContext offsetContext, io.debezium.util.Clock clock)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void emitChangeRecords​(io.debezium.schema.DataCollectionSchema schema, io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver)  
      protected void emitCreateRecord​(io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver, io.debezium.relational.TableSchema tableSchema)  
      protected void emitDeleteRecord​(io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver, io.debezium.relational.TableSchema tableSchema)  
      protected void emitReadRecord​(io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver, io.debezium.relational.TableSchema tableSchema)  
      protected void emitTruncateRecord​(io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver, io.debezium.relational.TableSchema schema)  
      protected void emitUpdateAsPrimaryKeyChangeRecord​(io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver, io.debezium.relational.TableSchema tableSchema, org.apache.kafka.connect.data.Struct oldKey, org.apache.kafka.connect.data.Struct newKey, org.apache.kafka.connect.data.Struct oldValue, org.apache.kafka.connect.data.Struct newValue)  
      protected void emitUpdateRecord​(io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver, io.debezium.relational.TableSchema tableSchema)  
      protected Optional<org.apache.kafka.connect.header.ConnectHeaders> getEmitConnectHeaders()  
      protected abstract Object[] getNewColumnValues()
      Returns the new row state in case of a CREATE or READ.
      protected abstract Object[] getOldColumnValues()
      Returns the old row state in case of an UPDATE or DELETE.
      protected boolean skipEmptyMessages()
      Whether empty data messages should be ignored.
      • Methods inherited from class io.debezium.pipeline.AbstractChangeRecordEmitter

        getClock, getOffset, getPartition
      • Methods inherited from interface io.debezium.pipeline.spi.ChangeRecordEmitter

        getOperation
    • Constructor Detail

      • RelationalChangeRecordEmitter

        public RelationalChangeRecordEmitter​(P partition,
                                             io.debezium.pipeline.spi.OffsetContext offsetContext,
                                             io.debezium.util.Clock clock)
    • Method Detail

      • emitChangeRecords

        public void emitChangeRecords​(io.debezium.schema.DataCollectionSchema schema,
                                      io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver)
                               throws InterruptedException
        Specified by:
        emitChangeRecords in interface io.debezium.pipeline.spi.ChangeRecordEmitter<P extends io.debezium.pipeline.spi.Partition>
        Overrides:
        emitChangeRecords in class io.debezium.pipeline.AbstractChangeRecordEmitter<P extends io.debezium.pipeline.spi.Partition,​io.debezium.relational.TableSchema>
        Throws:
        InterruptedException
      • emitCreateRecord

        protected void emitCreateRecord​(io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver,
                                        io.debezium.relational.TableSchema tableSchema)
                                 throws InterruptedException
        Specified by:
        emitCreateRecord in class io.debezium.pipeline.AbstractChangeRecordEmitter<P extends io.debezium.pipeline.spi.Partition,​io.debezium.relational.TableSchema>
        Throws:
        InterruptedException
      • emitReadRecord

        protected void emitReadRecord​(io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver,
                                      io.debezium.relational.TableSchema tableSchema)
                               throws InterruptedException
        Specified by:
        emitReadRecord in class io.debezium.pipeline.AbstractChangeRecordEmitter<P extends io.debezium.pipeline.spi.Partition,​io.debezium.relational.TableSchema>
        Throws:
        InterruptedException
      • emitUpdateRecord

        protected void emitUpdateRecord​(io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver,
                                        io.debezium.relational.TableSchema tableSchema)
                                 throws InterruptedException
        Specified by:
        emitUpdateRecord in class io.debezium.pipeline.AbstractChangeRecordEmitter<P extends io.debezium.pipeline.spi.Partition,​io.debezium.relational.TableSchema>
        Throws:
        InterruptedException
      • emitDeleteRecord

        protected void emitDeleteRecord​(io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver,
                                        io.debezium.relational.TableSchema tableSchema)
                                 throws InterruptedException
        Specified by:
        emitDeleteRecord in class io.debezium.pipeline.AbstractChangeRecordEmitter<P extends io.debezium.pipeline.spi.Partition,​io.debezium.relational.TableSchema>
        Throws:
        InterruptedException
      • emitTruncateRecord

        protected void emitTruncateRecord​(io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver,
                                          io.debezium.relational.TableSchema schema)
                                   throws InterruptedException
        Throws:
        InterruptedException
      • getOldColumnValues

        protected abstract Object[] getOldColumnValues()
        Returns the old row state in case of an UPDATE or DELETE.
      • getNewColumnValues

        protected abstract Object[] getNewColumnValues()
        Returns the new row state in case of a CREATE or READ.
      • skipEmptyMessages

        protected boolean skipEmptyMessages()
        Whether empty data messages should be ignored.
        Returns:
        true if empty data messages coming from data source should be ignored. Typical use case are PostgreSQL changes without FULL replica identity.
      • emitUpdateAsPrimaryKeyChangeRecord

        protected void emitUpdateAsPrimaryKeyChangeRecord​(io.debezium.pipeline.spi.ChangeRecordEmitter.Receiver<P> receiver,
                                                          io.debezium.relational.TableSchema tableSchema,
                                                          org.apache.kafka.connect.data.Struct oldKey,
                                                          org.apache.kafka.connect.data.Struct newKey,
                                                          org.apache.kafka.connect.data.Struct oldValue,
                                                          org.apache.kafka.connect.data.Struct newValue)
                                                   throws InterruptedException
        Throws:
        InterruptedException
      • getEmitConnectHeaders

        protected Optional<org.apache.kafka.connect.header.ConnectHeaders> getEmitConnectHeaders()