Skip to content

Strategy to choose when doing Serialization and Deserialization using spring-kafka library

I need to Serialize or Deserialize any type of Java Object may be Integer/ String or <T> or User or Account in my project. There might be more than 1 type I am not sure which one to use while configuring a Kafka Producer and Consumer.

There are JsonSerializer and JsonDeserializer and StringSerializer/DESer and many more types.

I have read

So how do i arrive at a conclusion on which one to use ? Thanks.



Typically, you would use JSON for that situation, but the objects User etc, must be “Jackson-friendly” (no-arg CTOR etc). Another alternative is Apache Avro and the confluent (De)Serializers.

3 People found this is helpful