You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Chia-Ping Tsai (Jira)" <ji...@apache.org> on 2021/01/27 06:57:00 UTC
[jira] [Commented] (KAFKA-12227) Add method "Producer#produce" to
return CompletionStage instead of Future
[ https://issues.apache.org/jira/browse/KAFKA-12227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17272613#comment-17272613 ]
Chia-Ping Tsai commented on KAFKA-12227:
----------------------------------------
[~ijuma] I have filed a discuss thread (https://lists.apache.org/thread.html/r197ef07a40ca13e7323289ca59e329a849984361ef5ff7b71bd65d0d%40%3Cdev.kafka.apache.org%3E). Please take a look :)
> Add method "Producer#produce" to return CompletionStage instead of Future
> --------------------------------------------------------------------------
>
> Key: KAFKA-12227
> URL: https://issues.apache.org/jira/browse/KAFKA-12227
> Project: Kafka
> Issue Type: Improvement
> Reporter: Chia-Ping Tsai
> Assignee: 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)