0

Can the serialVersionUID be defined in the class that extends the Kafka interface Serializer/Deserializer (org.apache.kafka.common.serialization), similar to the one we implement with Serializable? Would we face exception - NotSerializableException, during Java/Kafka upgrade?

For example, in KTable the key/value is serialized with a custom class object. So, if we persisted some data and if any upgrade takes place for either Kafka OR Java OR both, will we be able to to read (deserialize) the key/value, that was persisted prior to the upgrade, without any backward compatibility constraints?

Reference: What is a serialVersionUID and why should I use it?

Raman
  • 665
  • 1
  • 15
  • 38

1 Answers1

0

If you write a custom Kafka Serializer/Deserializer there is no need to specify Java's serialVersionUID. You can still do it, but it would be unused.

The purpose of Java's serialVersionUID is to use Java's built in serialization mechanism. But this mechanism is not used when you implement a custom Serializer/Deserializer for Kafka.

Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137