Interface SchemaIdSerializer

All Superinterfaces:
AutoCloseable, Closeable, org.apache.kafka.common.Configurable
All Known Implementing Classes:
HeaderSchemaIdSerializer, PrefixSchemaIdSerializer

public interface SchemaIdSerializer extends org.apache.kafka.common.Configurable, Closeable
A SchemaIdSerializer is used by a serializer to determine how to serialize schema identifiers. It is invoked after the payload has been converted to bytes.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
     
    default void
    configure(Map<String,?> configs)
     
    byte[]
    serialize(String topic, boolean isKey, org.apache.kafka.common.header.Headers headers, byte[] payload, SchemaId schemaId)
    Associates a schema identifier with the payload.
  • Method Details

    • configure

      default void configure(Map<String,?> configs)
      Specified by:
      configure in interface org.apache.kafka.common.Configurable
    • serialize

      byte[] serialize(String topic, boolean isKey, org.apache.kafka.common.header.Headers headers, byte[] payload, SchemaId schemaId) throws org.apache.kafka.common.errors.SerializationException
      Associates a schema identifier with the payload.
      Parameters:
      topic - topic associated with the payload
      isKey - whether this is a record key or record value
      headers - headers associated with the record that can be mutated; may be empty.
      payload - serialized payload that does not include a schema identifier
      schemaId - schema identifier to be used; contains either an ID or GUID
      Returns:
      the serialized payload that may include a schema identifier
      Throws:
      org.apache.kafka.common.errors.SerializationException
    • close

      default void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException