[
https://issues.apache.org/jira/browse/KAFKA-6923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16544134#comment-16544134
]
Chia-Ping Tsai commented on KAFKA-6923:
---------------------------------------
In order to keep the BC, SC, and correct deprecation cycle(deprecate
Serializer/Deserializer in 2.0),, seems the solution of this issue is to
introduce a new class to replace the Serializer and Deserializer.
The new class should be a subclass of Serializer/Deserializer and it has the
method "byte[] serialize(String topic, Headers headers, T data)". Also, we have
to add default implementation of the new method to Serializer/Deserializer for
BC and SC.
{code:java}
@FunctionalInterface
interface NewSerializer {
byte[] serialize(String topic, Headers headers, T data);
void configure(Map<String, ?> configs, boolean isKey) {
// do nothing
}
void close() {
// do nothing
}
}
@Deprecated // use NewSerializer instead
interface Serializer extends NewSerializer {
@Override
default byte[] serialize(String topic, Headers headers, T data) {
return serializer.serialize(topic, data);
}
}{code}
In addition, the construction using the Serializer/Deserializer should be
deprecated too and replaced by new one.
> Consolidate ExtendedSerializer/Serializer and
> ExtendedDeserializer/Deserializer
> -------------------------------------------------------------------------------
>
> Key: KAFKA-6923
> URL: https://issues.apache.org/jira/browse/KAFKA-6923
> Project: Kafka
> Issue Type: Improvement
> Components: clients
> Reporter: Ismael Juma
> Assignee: Viktor Somogyi
> Priority: Major
> Labels: needs-kip
> Fix For: 2.1.0
>
>
> The Javadoc of ExtendedDeserializer states:
> {code}
> * Prefer {@link Deserializer} if access to the headers is not required. Once
> Kafka drops support for Java 7, the
> * {@code deserialize()} method introduced by this interface will be added to
> Deserializer with a default implementation
> * so that backwards compatibility is maintained. This interface may be
> deprecated once that happens.
> {code}
> Since we have dropped Java 7 support, we should figure out how to do this.
> There are compatibility implications, so a KIP is needed.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)