Skip to content
Advertisement

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 https://docs.spring.io/spring-kafka/reference/html/#string-serde

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

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement