Class DefaultHeadersHandler

java.lang.Object
io.apicurio.registry.serde.kafka.headers.DefaultHeadersHandler
All Implemented Interfaces:
HeadersHandler

public class DefaultHeadersHandler extends Object implements HeadersHandler
  • Constructor Details

    • DefaultHeadersHandler

      public DefaultHeadersHandler()
  • Method Details

    • configure

      public void configure(Map<String,Object> configs, boolean isKey)
      Specified by:
      configure in interface HeadersHandler
      See Also:
    • writeHeaders

      public void writeHeaders(org.apache.kafka.common.header.Headers headers, io.apicurio.registry.resolver.strategy.ArtifactReference reference)
      Specified by:
      writeHeaders in interface HeadersHandler
      See Also:
    • readHeaders

      public io.apicurio.registry.resolver.strategy.ArtifactReference readHeaders(org.apache.kafka.common.header.Headers headers)
      Description copied from interface: HeadersHandler
      Reads the kafka message headers and returns an ArtifactReference that can contain or not information to identify an Artifact in the registry.
      Specified by:
      readHeaders in interface HeadersHandler
      Parameters:
      headers -
      Returns:
      ArtifactReference
      See Also:
    • isUseSchemaFromHeaders

      public boolean isUseSchemaFromHeaders()
      Checks if schema reading from headers is enabled.
      Returns:
      true if schema should be read from headers
    • readSchemaFromHeaders

      public String readSchemaFromHeaders(org.apache.kafka.common.header.Headers headers)
      Reads the schema content from the headers.
      Parameters:
      headers - the Kafka message headers
      Returns:
      the schema content as a string, or null if not present
    • readSchemaTypeFromHeaders

      public String readSchemaTypeFromHeaders(org.apache.kafka.common.header.Headers headers)
      Reads the schema type from the headers.
      Parameters:
      headers - the Kafka message headers
      Returns:
      the schema type as a string (e.g., "AVRO", "PROTOBUF", "JSON"), or null if not present
    • writeSchemaToHeaders

      public void writeSchemaToHeaders(org.apache.kafka.common.header.Headers headers, String schemaContent)
      Writes the schema content to the headers.
      Parameters:
      headers - the Kafka message headers
      schemaContent - the schema content to write
    • writeSchemaTypeToHeaders

      public void writeSchemaTypeToHeaders(org.apache.kafka.common.header.Headers headers, String schemaType)
      Writes the schema type to the headers.
      Parameters:
      headers - the Kafka message headers
      schemaType - the schema type to write (e.g., "AVRO", "PROTOBUF", "JSON")