Bird
0
0

Which of the following is the correct syntax to start a Kafka console producer for topic 'my-topic' connecting to localhost:9092?

easy📝 Syntax Q3 of 15
Kafka - Basics and Event Streaming
Which of the following is the correct syntax to start a Kafka console producer for topic 'my-topic' connecting to localhost:9092?
Akafka-console-producer.sh --broker-list localhost:9092 --topic my-topic
Bkafka-console-producer.sh --topic my-topic --broker localhost:9092
Ckafka-console-producer.sh --topic=my-topic --broker-list=localhost:9092
Dkafka-console-producer.sh --broker localhost:9092 --topic my-topic
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct option names for kafka-console-producer.sh

    The correct options are --broker-list for brokers and --topic for topic name.
  2. Step 2: Match syntax with correct order and spelling

    kafka-console-producer.sh --broker-list localhost:9092 --topic my-topic uses correct flags and order: --broker-list localhost:9092 --topic my-topic.
  3. Final Answer:

    kafka-console-producer.sh --broker-list localhost:9092 --topic my-topic -> Option A
  4. Quick Check:

    Producer syntax = --broker-list + --topic [OK]
Quick Trick: Use --broker-list and --topic flags exactly as shown [OK]
Common Mistakes:
  • Using --broker instead of --broker-list
  • Using equals sign (=) instead of space
  • Swapping order of options

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes