[ 
https://issues.apache.org/jira/browse/KAFKA-12227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17268577#comment-17268577
 ] 

Ismael Juma commented on KAFKA-12227:
-------------------------------------

[~chia7712] Feel free to take over if you have cycles. I think we should 
explore this rejected alternative:
 * Introduce new methods that return CompletableFuture or CompletionStage to 
the Producer and KafkaProducer classes and deprecate the existing send methods. 
This is more disruptive, but cleaner long-term.

I think it's better long term, so we could do it for Apache Kafka 3.0. Finding 
a good name is challenging though. While we're at it, we could consider fixing 
the fact that method blocks the caller while awaiting metadata.

> Return CompletableFuture from KafkaProducer.send
> ------------------------------------------------
>
>                 Key: KAFKA-12227
>                 URL: https://issues.apache.org/jira/browse/KAFKA-12227
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Chia-Ping Tsai
>            Priority: Major
>
> Producer and KafkaProducer return a java.util.concurrent.Future from their 
> send methods. This makes it challenging to write asynchronous non-blocking 
> code given Future's limited interface. Since Kafka now requires Java 8, we 
> now have the option of using CompletionStage and/or CompletableFuture that 
> were introduced to solve this issue. It's worth noting that the Kafka 
> AdminClient solved this issue by using org.apache.kafka.common.KafkaFuture as 
> Java 7 support was still required then.
>  
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-XXX%3A+Return+CompletableFuture+from+KafkaProducer.send



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to