This is an automated email from the ASF dual-hosted git repository. jsancio pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push: new 2958dcb9191 KAFKA-13115; Update doSend doc about possible blocking (#11023) 2958dcb9191 is described below commit 2958dcb91919bc2698193057450c909fe457f551 Author: Ivan Vaskevych <ivan.vaskev...@gmail.com> AuthorDate: Tue May 14 16:50:56 2024 +0200 KAFKA-13115; Update doSend doc about possible blocking (#11023) Reviewers: José Armando García Sancio <jsan...@apache.org> --- .../java/org/apache/kafka/clients/producer/KafkaProducer.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java b/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java index e084233a0da..970b7e4e860 100644 --- a/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java +++ b/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java @@ -852,9 +852,12 @@ public class KafkaProducer<K, V> implements Producer<K, V> { /** * Asynchronously send a record to a topic and invoke the provided callback when the send has been acknowledged. * <p> - * The send is asynchronous and this method will return immediately once the record has been stored in the buffer of - * records waiting to be sent. This allows sending many records in parallel without blocking to wait for the - * response after each one. + * The send is asynchronous and this method will return immediately (except for rare cases described below) + * once the record has been stored in the buffer of records waiting to be sent. + * This allows sending many records in parallel without blocking to wait for the response after each one. + * Can block for the following cases: 1) For the first record being sent to + * the cluster by this client for the given topic. In this case it will block for up to {@code max.block.ms} milliseconds if + * Kafka cluster is unreachable; 2) Allocating a buffer if buffer pool doesn't have any free buffers. * <p> * The result of the send is a {@link RecordMetadata} specifying the partition the record was sent to, the offset * it was assigned and the timestamp of the record. If the producer is configured with acks = 0, the {@link RecordMetadata}