Class DebeziumHeaderProducer

java.lang.Object
io.debezium.connector.common.DebeziumHeaderProducer
All Implemented Interfaces:
Service

public class DebeziumHeaderProducer extends Object implements Service
A service implementation that produces Debezium-specific headers for CDC (Change Data Capture) events.

This class is responsible for creating standardized headers containing metadata about the Debezium connector context, which can be attached to Kafka Connect records to provide traceability and identification information.

Author:
Mario Fiore Vitale
  • Field Details

  • Constructor Details

    • DebeziumHeaderProducer

      public DebeziumHeaderProducer(CdcSourceTaskContext sourceTaskContext)
      Constructs a new DebeziumHeaderProducer with the specified source task context.
      Parameters:
      sourceTaskContext - the CDC source task context containing connector metadata; must not be null
  • Method Details

    • contextHeaders

      public org.apache.kafka.connect.header.ConnectHeaders contextHeaders()
      Creates and returns a set of standardized Debezium context headers.

      The returned headers include:

      • Connector Logical Name - The logical name of the Debezium connector
      • Task ID - The unique identifier of the connector task
      • Connector Name - The name of the Debezium connector

      These headers provide essential metadata for tracking and identifying the source of CDC events in downstream processing systems.

      Returns:
      a ConnectHeaders object containing the Debezium context headers; never returns null
      Throws:
      RuntimeException - if there's an error accessing the source task context