You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

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 state[One of "Under Discussion", "Accepted", "Rejected"]

Discussion thread: https://lists.apache.org/thread/n3k6vb4vddl1s5nopcyglnddtvzp4j63

JIRA: KAFKA-16796

Motivation

We are going to move all tools-related code from core module (scala) to tools module (java) in 4.0. kafka.serializer.Decoder is a public APIs and it is in core module. Hence we need to introduce replacement to deprecate it in 3.8.0

Public Interfaces

The new java interface org.apache.kafka.tools.api.Decoder is shown below. It is located at tools-api module, since it must be accessible by core module.

@FunctionalInterface
public interface Decoder<T> {
    T fromBytes(byte[] bytes);
}


The old scala trait will extend the new java interface with deprecated  annotation

@deprecated(since = "3.8.0")
trait Decoder[T] extends org.apache.kafka.tools.api.Decoder[T] {
  def fromBytes(bytes: Array[Byte]): T
}


Proposed Changes

Introduce a new java interface org.apache.kafka.tools.api.Decoder to replace scala trait kafka.serializer.Decoder

Compatibility, Deprecation, and Migration Plan

  • before 4.0, users can keep using the deprecated kafka.serializer.Decoder
  • after 4.0, all users need to update is the superclass is changed from kafka.serializer.Decoder to org.apache.kafka.tools.api.Decoder. They have same methods, so users don't need to change any code of method implementation
  • before 4.0, users can access both interfaces by depending on core module.
  • after 4.0, users need to import tools-api module if core module is gone

Test Plan

The new unit test used to verify the "warning messages" about deprecated kafka.serializer.Decoder will be added. The messages are used to encourage users to adopt the new interface

Rejected Alternatives

N/A

  • No labels