diff --git a/examples/README.md b/examples/README.md index 2272638454ed9..dd458fbb25106 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 7ab93d6a8cdbe..769e0ce7c4e43 100644 --- a/examples/src/main/java/kafka/examples/KafkaConsumerProducerDemo.java +++ b/examples/src/main/java/kafka/examples/KafkaConsumerProducerDemo.java @@ -24,8 +24,8 @@ * This example can be decomposed into the following stages: *
* 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. *
* 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 static void main(String[] args) { 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();