Versions Compared

Key

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

...

This change is binary compatible because org.apache.kafka.clients.producer.Producer.send(ProducerRecord) still returns Future. The use of covariant return types causes the bytecode to contain methods with the old and new signature.

Future work

After we introduce new record class "SendRecord", we should NOT use ProducerRecord in our production code. There are some public interface (ProducerInterceptor, for example) still accept ProducerRecord and so we need other KIPs as follow-up to deprecate them.We should encourage users to use new API and new interfaces (SendRecord and SendTarget). Hence, users should NOT create ProducerRecord anymore. We should deprecate all constructors of ProducerRecord. 

Rejected Alternatives

  • Return CompletableFuture from KafkaProducer.send
  • Change send() to return CompletableFuture. This is not a compatible change.
  • Return CompletionStage instead of CompletableFuture. The former doesn't extend the Future interface, so it's incompatible unless we introduce new methods.