Lukas
Lukas

Reputation: 14303

How to (de)serialize POJO to Avro and Kafka without generating code

I want to serialize a POJO to Kafka using Avro but I do not want to generate the POJO. There are several reason that I do not want to use generated code.

  1. I want to have control about the POJO structure. I want to use inheritance, I want to add methods, I want to use Kotlin data classes
  2. Avro generated code has some issues like this one

Upvotes: 1

Views: 1543

Answers (1)

Lukas
Lukas

Reputation: 14303

You can use Jackson Kafka Avro serializer which does exactly that. It (de)serializes the data using Jackson so you can easily map the POJOs to Avro schemas and back. Moreover, it has first class Kotlin support.

Upvotes: 1

Related Questions