[ https://issues.apache.org/jira/browse/KAFKA-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15698939#comment-15698939 ]
Jason Guo edited comment on KAFKA-4449 at 11/27/16 3:19 AM: ------------------------------------------------------------ @Ewen Cheslack-Postava Agree with you that we should lable it as POJOJSONSerializer so that users know it will serialize the POJO to JSON. Schema functionality is not only useful for Kafka connect, but also useful for Kafka Stream. For Kafka Stream, we do need some mechanism to serialize/deserialize POJOs (most of time we define the schema with POJOs) conveniently instead of creating a pair of serializer/deserializer and a Serde for each kind of POJO which is verbose as shown in https://github.com/apache/kafka/blob/trunk/streams/examples/src/main/java/org/apache/kafka/streams/examples/pageview/PageViewTypedDemo.java For schema functionality, JSONPOJOSerializer is a start, we can also provide POJOAvroSerializer as well as some other common Serializer. was (Author: habren): Ewen Cheslack-Postava Agree with you that we should lable it as POJOJSONSerializer so that users know it will serialize the POJO to JSON. Schema functionality is not only useful for Kafka connect, but also useful for Kafka Stream. For Kafka Stream, we do need some mechanism to serialize/deserialize POJOs (most of time we define the schema with POJOs) conveniently instead of creating a pair of serializer/deserializer and a Serde for each kind of POJO which is verbose as shown in https://github.com/apache/kafka/blob/trunk/streams/examples/src/main/java/org/apache/kafka/streams/examples/pageview/PageViewTypedDemo.java For schema functionality, JSONPOJOSerializer is a start, we can also provide POJOAvroSerializer as well as some other common Serializer. > 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)