The purpose of GenericAvroSerializer/Deserializer

160 views
Skip to first unread message

Tianxiang Xiong

unread,
Sep 20, 2016, 2:51:30 AM9/20/16
to Confluent Platform
I was reading the Kafka Streams documentation about serdes when I came across GenericAvroSerializer and GenericAvroDeserializer. Seeing as how they simply wrap KafkaAvroSerializer and KafkaAvroDeserializer, why are they needed? Why not just use the Kafka- versions directly?

Michael Noll

unread,
Sep 23, 2016, 11:26:53 AM9/23/16
to confluent...@googlegroups.com
Kafka Streams combines a pair of "matching" serializer and deserializer into a single serde (shorthand for "serializer/deserializer").  The main reason is that, with a single serde, you only need to pass a single parameter to the various API functions that require serde information rather than two separate parameters (one for serializer, another one for deserializer).  This unification was done based on early user feedback we got for Kafka Streams, when the original API still used two params.



On Tue, Sep 20, 2016 at 8:51 AM, Tianxiang Xiong <tianxia...@gmail.com> wrote:
I was reading the Kafka Streams documentation about serdes when I came across GenericAvroSerializer and GenericAvroDeserializer. Seeing as how they simply wrap KafkaAvroSerializer and KafkaAvroDeserializer, why are they needed? Why not just use the Kafka- versions directly?

--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platform+unsub...@googlegroups.com.
To post to this group, send email to confluent-platform@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/d18098c2-b058-4a6f-8ee1-6f9e1857de43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Michael G. Noll
Product Manager | Confluent
Follow us: Twitter | Blog

Tianxiang Xiong

unread,
Sep 24, 2016, 1:16:14 AM9/24/16
to Confluent Platform
Thanks, but that's not what I was asking. I'm not talking about Serdes. I've previously asked a question about Serdes, which Marik Svetok kindly answered.

I'm wondering why we need the Generic* classes, when all they do is delegate to the KafkaAvro* classes. Why can't we use the KafkaAvro* classes directly?

On Friday, 23 September 2016 08:26:53 UTC-7, Michael Noll wrote:
Kafka Streams combines a pair of "matching" serializer and deserializer into a single serde (shorthand for "serializer/deserializer").  The main reason is that, with a single serde, you only need to pass a single parameter to the various API functions that require serde information rather than two separate parameters (one for serializer, another one for deserializer).  This unification was done based on early user feedback we got for Kafka Streams, when the original API still used two params.


On Tue, Sep 20, 2016 at 8:51 AM, Tianxiang Xiong <tianxia...@gmail.com> wrote:
I was reading the Kafka Streams documentation about serdes when I came across GenericAvroSerializer and GenericAvroDeserializer. Seeing as how they simply wrap KafkaAvroSerializer and KafkaAvroDeserializer, why are they needed? Why not just use the Kafka- versions directly?

--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platform+unsub...@googlegroups.com.
To post to this group, send email to confluent...@googlegroups.com.

Michael Noll

unread,
Sep 26, 2016, 4:52:01 AM9/26/16
to confluent...@googlegroups.com
Ah, I see.

The answer is because KafkaAvroSerializer implements Serializer<Object>, but for Kafka Streams we need Serializer<GenericRecord>, which is what GenericAvroSerializer provides.



On Sat, Sep 24, 2016 at 7:16 AM, Tianxiang Xiong <tianxia...@fundingcircle.com> wrote:
Thanks, but that's not what I was asking. I'm not talking about Serdes. I've previously asked a question about Serdes, which Marik Svetok kindly answered.

I'm wondering why we need the Generic* classes, when all they do is delegate to the KafkaAvro* classes. Why can't we use the KafkaAvro* classes directly?

On Friday, 23 September 2016 08:26:53 UTC-7, Michael Noll wrote:
Kafka Streams combines a pair of "matching" serializer and deserializer into a single serde (shorthand for "serializer/deserializer").  The main reason is that, with a single serde, you only need to pass a single parameter to the various API functions that require serde information rather than two separate parameters (one for serializer, another one for deserializer).  This unification was done based on early user feedback we got for Kafka Streams, when the original API still used two params.


On Tue, Sep 20, 2016 at 8:51 AM, Tianxiang Xiong <tianxia...@gmail.com> wrote:
I was reading the Kafka Streams documentation about serdes when I came across GenericAvroSerializer and GenericAvroDeserializer. Seeing as how they simply wrap KafkaAvroSerializer and KafkaAvroDeserializer, why are they needed? Why not just use the Kafka- versions directly?

--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platform+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages