...
This KIP was created as a result of this pull request.
Proposed Change
The only way to make it work without naming clash is to rename these implicits. In scala implicits are usually named like these:
Code Block | ||||
---|---|---|---|---|
| ||||
implicit def longSerde: Serde[Long] = ??? |
Changed public Interfaces
Create a new org.apache.kafka.streams.scala.serialization.Serdes
. It will be like an old one, but with other implicits names. The old version of Serdes should be marked as deprecated.
Changed public Interfaces
New serdes in the org.apache.kafka.streams.scala.serialization.Serdes
object should look New serde names should looks like these:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
implicit def stringSerde: Serde[String] = ??? implicit def longSerde: Serde[Long] = ??? implicit def javaLongSerde: Serde[java.lang.Long] = ??? implicit def byteArraySerde: Serde[Array[Byte]] = ??? implicit def bytesSerde: Serde[org.apache.kafka.common.utils.Bytes] = ??? implicit def floatSerde: Serde[Float] = ??? implicit def javaFloatSerde: Serde[java.lang.Float] = ??? implicit def doubleSerde: Serde[Double] = ??? implicit def javaDoubleSerde: Serde[java.lang.Double] = ??? implicit def intSerde: Serde[Int] = ??? implicit def javaIntegerSerde: Serde[java.lang.Integer] = ??? |
...
Migration Plan, Compatibility and Deprecation
These Proposed changes are backward compatible. The old code remains the same.
An old both not binary and not code compatible with the current 2.5 version. Also, users could use these implicits by its full name (org.apache.kafka.streams.scala.Serdes.String
). It means that we should pass these changes through deprecation cycle. I propose the next plan:
First release:
...
will be marked as deprecated and could be deleted with the major 3.0 release.
Rejected Alternatives
Rename serdes in the old org.apache.kafka.streams.scala.Serdes
...
Renaming serdes will require a complex migration plan. We would need to create a new serdes with the new naming near old serdes. Old serdes will be marked as deprecated. And old, deprecated serdes, could be deleted only with the major 3.0 release. It's too far away from now and too complex for such change
...
It will look like these (example for a single serde):
Code Block | ||||
---|---|---|---|---|
| ||||
implicit def longSerde: Serde[Long] = ???
@deprecated
def Long: Serde[Long] = longSerde |
...
- Remove deprecated serdes.
The original problem will be solved only after the second release.