Interface VeniceKafkaSerializer<T>

Type Parameters:
T - The type of the object that is mapped by this serializer
All Superinterfaces:
AutoCloseable, Closeable, org.apache.kafka.common.serialization.Deserializer<T>, org.apache.kafka.common.serialization.Serializer<T>
All Known Implementing Classes:
ChunkedKeySuffixSerializer, ChunkedValueManifestSerializer, DefaultSerializer, InternalAvroSpecificSerializer, KafkaKeySerializer, KafkaValueSerializer, OptimizedKafkaValueSerializer, StringSerializer, VeniceAvroKafkaSerializer

public interface VeniceKafkaSerializer<T> extends org.apache.kafka.common.serialization.Serializer<T>, org.apache.kafka.common.serialization.Deserializer<T>
Map objects to byte arrays and back again
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Close this serializer.
    void
    configure(Map<String,?> configMap, boolean isKey)
    Configure this class.
    deserialize(String topic, byte[] bytes)
    Create an object from an array of bytes
    byte[]
    serialize(String topic, T object)
    Construct an array of bytes from the given object

    Methods inherited from interface org.apache.kafka.common.serialization.Deserializer

    deserialize

    Methods inherited from interface org.apache.kafka.common.serialization.Serializer

    serialize
  • Method Details

    • close

      void close()
      Close this serializer. This method has to be idempotent if the serializer is used in KafkaProducer because it might be called multiple times.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.apache.kafka.common.serialization.Deserializer<T>
      Specified by:
      close in interface org.apache.kafka.common.serialization.Serializer<T>
    • configure

      void configure(Map<String,?> configMap, boolean isKey)
      Configure this class.
      Specified by:
      configure in interface org.apache.kafka.common.serialization.Deserializer<T>
      Specified by:
      configure in interface org.apache.kafka.common.serialization.Serializer<T>
      Parameters:
      configMap - configs in key/value pairs
      isKey - whether is for key or value
    • serialize

      byte[] serialize(String topic, T object)
      Construct an array of bytes from the given object
      Specified by:
      serialize in interface org.apache.kafka.common.serialization.Serializer<T>
      Parameters:
      topic - Topic to which the object belongs.
      object - The object
      Returns:
      The bytes taken from the object
    • deserialize

      T deserialize(String topic, byte[] bytes)
      Create an object from an array of bytes
      Specified by:
      deserialize in interface org.apache.kafka.common.serialization.Deserializer<T>
      Parameters:
      topic - Topic to which the array of bytes belongs.
      bytes - An array of bytes with the objects data
      Returns:
      A java object serialzed from the bytes