This is an automated email from the ASF dual-hosted git repository.
chia7712 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 6f4b47d61c0 KAFKA-20089 clients - update javadocs -- while topic
being created in background (#21959)
6f4b47d61c0 is described below
commit 6f4b47d61c05de228d726095b7437b182f9c35ce
Author: Murali Basani <[email protected]>
AuthorDate: Thu Apr 9 11:21:33 2026 +0200
KAFKA-20089 clients - update javadocs -- while topic being created in
background (#21959)
https://issues.apache.org/jira/browse/KAFKA-20089
Changing the error code needs a kip. For now updating javadocs. A kip
will be proposed later.
Reviewers: Chia-Ping Tsai <[email protected]>
---
.../org/apache/kafka/clients/consumer/KafkaConsumer.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git
a/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
b/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
index 1897bf54fad..5e2f47b5b2c 100644
--- a/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
+++ b/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
@@ -1429,7 +1429,11 @@ public class KafkaConsumer<K, V> implements Consumer<K,
V> {
*
* @param topic The topic to get partition metadata for
*
- * @return The list of partitions, which will be empty when the given
topic is not found
+ * @return The list of partitions, which will be empty when the given
topic is not found.
+ * Note: when both the broker config {@code
auto.create.topics.enable} and the consumer
+ * config {@code allow.auto.create.topics} are {@code true}, this
method may return an
+ * empty list even though the topic is being auto-created in the
background. Callers
+ * should not assume the topic does not exist based solely on an
empty result.
* @throws org.apache.kafka.common.errors.WakeupException if {@link
#wakeup()} is called before or while this
* function is called
* @throws org.apache.kafka.common.errors.InterruptException if the
calling thread is interrupted before or while
@@ -1452,7 +1456,11 @@ public class KafkaConsumer<K, V> implements Consumer<K,
V> {
* @param topic The topic to get partition metadata for
* @param timeout The maximum of time to await topic metadata
*
- * @return The list of partitions, which will be empty when the given
topic is not found
+ * @return The list of partitions, which will be empty when the given
topic is not found.
+ * Note: when both the broker config {@code
auto.create.topics.enable} and the consumer
+ * config {@code allow.auto.create.topics} are {@code true}, this
method may return an
+ * empty list even though the topic is being auto-created in the
background. Callers
+ * should not assume the topic does not exist based solely on an
empty result.
* @throws org.apache.kafka.common.errors.WakeupException if {@link
#wakeup()} is called before or while this
* function is called
* @throws org.apache.kafka.common.errors.InterruptException if the
calling thread is interrupted before or while