Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This page is meant as a template for writing a KIP. To create a KIP choose Tools->Copy on this page and modify with your content and replace the heading with the next KIP number and a description of your issue. Replace anything in italics with your own description.

Status

Current stateUnder Discussionadopt

Discussion thread: TBDhere

Votehere

JIRA:

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyKAFKA-6161

...

In most cases the method close() and configure() are useless for kafka users. Since kafka 2.x+ is up on jdk8, we can add the default implementation in order to make them be functional interface. And then enable kafka user can to write less code to implement custom Serializer, Deserializer, and Serde.

...

In org.apache.kafka.common.serialization.Serde, org.apache.kafka.common.serialization.Serializer and org.apache.kafka.common.serialization.Deserializer, we will add empty implementations to close() and configure(). Also, we will add the annotation "FunctionalInterface" to Deserializer and Serializer.

Code Block
titleSerde.java
default void configure(Map<String, ?> configs, boolean isKey) {
  // intentionally left blank
}
default void close() {
  // intentionally left blank
}

...

Code Block
titleSerializer
@FunctionalInterface
public interface Serializer<T> extends Closeable {
 default void configure(Map<String, ?> configs, boolean isKey) {
    // intentionally left blank
  }
  default void close() {
    // intentionally left blank
  }
}

...

Code Block
titleDeserializer
@FunctionalInterface
public interface Deserializer<T> extends Closeable {
  default void configure(Map<String, ?> configs, boolean isKey) {
    // intentionally left blank
  }
  default void close() {
    // intentionally left blank
  }
}

...