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 234548262c5 KAFKA-18951 Correct topic name in client example docs 
(#22812)
234548262c5 is described below

commit 234548262c574d1428a4a21bc0c734db689e4681
Author: Gabriel Dutra <[email protected]>
AuthorDate: Thu Jul 16 15:08:30 2026 -0700

    KAFKA-18951 Correct topic name in client example docs (#22812)
    
    ## What changed
    
    - replace stale `topic1` references with the demo's actual `my-topic`
    topic name
    - correct the README wording from "to synchronous send" to "to
    synchronously send"
    - keep the Java example comments consistent with the README and
    `TOPIC_NAME`
    
    ## Why
    
    The producer/consumer example uses `my-topic`, but its documentation
    still referred to `topic1`. This mismatch could confuse users following
    the example.
    
    ## Validation
    
    - `./gradlew :examples:compileJava :examples:checkstyleMain
    spotlessCheck`
    - `git diff --check`
    
    Reviewers: Chia-Ping Tsai <[email protected]>
---
 examples/README.md                                                | 4 ++--
 .../src/main/java/kafka/examples/KafkaConsumerProducerDemo.java   | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/examples/README.md b/examples/README.md
index 2272638454e..dd458fbb251 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -3,7 +3,7 @@
 This module contains some Kafka client examples.
 
 1. Start a local single-broker Kafka cluster with a plain listener configured 
on port 9092.
-2. Run `examples/bin/java-producer-consumer-demo.sh 10000` to asynchronously 
send 10k records to topic1 and consume them.
-3. Run `examples/bin/java-producer-consumer-demo.sh 10000 sync` to synchronous 
send 10k records to topic1 and consume them.
+2. Run `examples/bin/java-producer-consumer-demo.sh 10000` to asynchronously 
send 10k records to `my-topic` and consume them.
+3. Run `examples/bin/java-producer-consumer-demo.sh 10000 sync` to 
synchronously send 10k records to `my-topic` and consume them.
 4. Run `examples/bin/exactly-once-demo.sh 6 3 10000` to create input-topic and 
output-topic with 6 partitions each,
    start 3 transactional application instances and process 10k records.
diff --git 
a/examples/src/main/java/kafka/examples/KafkaConsumerProducerDemo.java 
b/examples/src/main/java/kafka/examples/KafkaConsumerProducerDemo.java
index 7ab93d6a8cd..769e0ce7c4e 100644
--- a/examples/src/main/java/kafka/examples/KafkaConsumerProducerDemo.java
+++ b/examples/src/main/java/kafka/examples/KafkaConsumerProducerDemo.java
@@ -24,8 +24,8 @@ import java.util.concurrent.TimeUnit;
  * This example can be decomposed into the following stages:
  * <p>
  * 1. Clean any topics left from previous runs.
- * 2. Create a producer thread to send a set of records to topic1.
- * 3. Create a consumer thread to fetch all previously sent records from 
topic1.
+ * 2. Create a producer thread to send a set of records to my-topic.
+ * 3. Create a consumer thread to fetch all previously sent records from 
my-topic.
  * <p>
  * If you are using IntelliJ IDEA, the above arguments should be put in 
`Modify Run Configuration - Program Arguments`.
  * You can also set an output log file in `Modify Run Configuration - Modify 
options - Save console output to file` to
@@ -51,12 +51,12 @@ public class KafkaConsumerProducerDemo {
             Utils.recreateTopics(KafkaProperties.BOOTSTRAP_SERVERS, -1, 
TOPIC_NAME);
             CountDownLatch latch = new CountDownLatch(2);
 
-            // stage 2: produce records to topic1
+            // stage 2: produce records to my-topic
             Producer producerThread = new Producer(
                 "producer", KafkaProperties.BOOTSTRAP_SERVERS, TOPIC_NAME, 
isAsync, null, false, numRecords, -1, latch);
             producerThread.start();
 
-            // stage 3: consume records from topic1
+            // stage 3: consume records from my-topic
             Consumer consumerThread = new Consumer(
                 "consumer", KafkaProperties.BOOTSTRAP_SERVERS, TOPIC_NAME, 
GROUP_NAME, Optional.empty(), false, numRecords, latch);
             consumerThread.start();

Reply via email to