[ 
https://issues.apache.org/jira/browse/KAFKA-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15698784#comment-15698784
 ] 

Ewen Cheslack-Postava commented on KAFKA-4449:
----------------------------------------------

[~habren] We actually try to keep serialization format specific stuff out of 
Kafka's core libraries. Why should we include this support for JSON (but not 
labelled as such), but not include it for Avro, protobufs, thrift, msgpack, 
capnproto, flatbuffers, etc?

In practice, we actually *do* include a JSON serializer already. See 
org.apache.kafka.connect.json.JsonSerializer for something that handles Jackson 
JsonNodes (but admittedly does not handle all POJOs currently). The only reason 
we include this is that we need *something* to demo the schema functionality 
that Kafka Connect supports and JSON happens to be very easy for demo purposes.

> Add Serializer/Deserializer for POJO
> ------------------------------------
>
>                 Key: KAFKA-4449
>                 URL: https://issues.apache.org/jira/browse/KAFKA-4449
>             Project: Kafka
>          Issue Type: Improvement
>          Components: clients
>    Affects Versions: 0.10.0.1
>            Reporter: Jason Guo
>            Priority: Minor
>              Labels: easyfix, features
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Currently, there are only build-in serializer/deserializer for basic data 
> type (String, Long, etc). It's better to have serializer/deserializer for 
> POJO.
> If we had this, user can serialize/deserialize all of their POJO with it. 
> Otherwise, user may need to create e pair of serializer and deserializer for 
> each kind of POJO, just like the implementation in the stream example 
> PageViewTypeDemo
> https://github.com/apache/kafka/blob/trunk/streams/examples/src/main/java/org/apache/kafka/streams/examples/pageview/PageViewTypedDemo.java
> Let's take above streams-example as an example, Serde was created for 
> PageView as below
>     final Serializer<PageView> pageViewSerializer = new 
> JsonPOJOSerializer<>();
>     serdeProps.put("JsonPOJOClass", PageView.class);
>     pageViewSerializer.configure(serdeProps, false);
>     final Deserializer<PageView> pageViewDeserializer = new 
> JsonPOJODeserializer<>();
>     serdeProps.put("JsonPOJOClass", PageView.class);
>     pageViewDeserializer.configure(serdeProps, false);
>     final Serde<PageView> pageViewSerde = 
> Serdes.serdeFrom(pageViewSerializer, pageViewDeserializer);
> If we use this POJO serializer/deserializer, the Serde can be created with 
> only one line
> Serdes.serdeFrom(RegionCount.class)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to