Reputation: 39
I am very much new to Kafka and Kryo. I have been working with simple String messages over Kafka with the default Kafka Serializer but I'm trying to use Kryo Serialization wihout success.
Could someone explain or show me an example of sending some java object over Kafka with kryo Serialization (Producer and Consumer)?
I have seen other questions in stackoverflow about the same topic without answer and I cannot comment on it. Apologize in advance.
Thanks.
Upvotes: 2
Views: 3002
Reputation: 835
I am probably digressing from the question but wanted to provide some of our experience.
We started with Kafka + Kyro and while it is certainly can be done, we found that schema management with Kyro could be troublesome in long term. So we rather went with Jackson serilaizer (org.codehaus.jackson.map.ObjectMapper).
To implement a Kyro serializer you would just need to inherit Kafka's serializer
import org.apache.kafka.common.serialization.Serializer;
public class KryoSerializer implements Serializer<YourObject>
and override serialize method.
Good luck.
Upvotes: 4