Class PrefixSchemaIdSerializer

java.lang.Object
io.confluent.kafka.serializers.schema.id.PrefixSchemaIdSerializer
All Implemented Interfaces:
SchemaIdSerializer, Closeable, AutoCloseable, org.apache.kafka.common.Configurable

public class PrefixSchemaIdSerializer extends Object implements SchemaIdSerializer
A PrefixSchemaIdSerializer adds a schema ID to the payload prefix.
  • Constructor Details

    • PrefixSchemaIdSerializer

      public PrefixSchemaIdSerializer()
  • Method Details

    • serialize

      public byte[] serialize(String topic, boolean isKey, org.apache.kafka.common.header.Headers headers, byte[] payload, SchemaId schemaId) throws org.apache.kafka.common.errors.SerializationException
      Description copied from interface: SchemaIdSerializer
      Associates a schema identifier with the payload.
      Specified by:
      serialize in interface SchemaIdSerializer
      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