Class KafkaKeySerializer
java.lang.Object
com.linkedin.venice.serialization.KafkaKeySerializer
- All Implemented Interfaces:
VeniceKafkaSerializer<KafkaKey>
,Closeable
,AutoCloseable
VeniceKafkaSerializer
to encode/decode KafkaKey
for Venice customized kafka message
Used by Kafka to convert to/from byte arrays.
KafkaKey
Schema (in order)
- Key header byte - Either 0 (PUT or DELETE), or 2 (CONTROL_MESSAGE)
- Payload (Key Object)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close this serializer.void
Configure this class.deserialize
(String topic, byte[] bytes) Create an object from an array of bytesbyte[]
Construct an array of bytes from the given object
-
Constructor Details
-
KafkaKeySerializer
public KafkaKeySerializer()
-
-
Method Details
-
deserialize
Description copied from interface:VeniceKafkaSerializer
Create an object from an array of bytes- Specified by:
deserialize
in interfaceVeniceKafkaSerializer<KafkaKey>
- 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
-
serialize
Description copied from interface:VeniceKafkaSerializer
Construct an array of bytes from the given object- Specified by:
serialize
in interfaceVeniceKafkaSerializer<KafkaKey>
- Parameters:
topic
- Topic to which the object belongs.kafkaKey
- The object- Returns:
- The bytes taken from the object
-
configure
Description copied from interface:VeniceKafkaSerializer
Configure this class.- Specified by:
configure
in interfaceVeniceKafkaSerializer<KafkaKey>
- Parameters:
configMap
- configs in key/value pairsisKey
- whether is for key or value
-
close
public void close()Description copied from interface:VeniceKafkaSerializer
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceVeniceKafkaSerializer<KafkaKey>
-