You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "John Roesler (JIRA)" <ji...@apache.org> on 2019/05/31 14:33:01 UTC

[jira] [Created] (KAFKA-8455) Add NothingSerde to Serdes

John Roesler created KAFKA-8455:
-----------------------------------

             Summary: Add NothingSerde to Serdes
                 Key: KAFKA-8455
                 URL: https://issues.apache.org/jira/browse/KAFKA-8455
             Project: Kafka
          Issue Type: Improvement
          Components: streams
            Reporter: John Roesler


Often, when reading an input topic, the key is expected to be null, but there's actually no way to represent this fact in Consumed, leading to confusing type signatures down the topology.

For example, you might use the BytesSerde, but then you have a KStream<Bytes,...>. When maintaining a large application, this becomes a hazard, since you'd need to "be really careful" not to try and dereference the key at any point, since you actually know it's always null.

Much better would be to actually represent the fact that the key is null, using the Void type. One such example of this is the NothingSerde I wrote here: https://github.com/confluentinc/kafka-streams-examples/blob/5.2.1-post/src/test/java/io/confluent/examples/streams/IntegrationTestUtils.java#L465

After some conversations, I've come to believe this would actually be a useful addition to the main Serdes collection.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)