Bird
0
0

You want to test Kafka by sending messages to a topic named 'test'. Which sequence of commands is correct after starting Zookeeper and Kafka server?

hard📝 Application Q15 of 15
Kafka - Basics and Event Streaming
You want to test Kafka by sending messages to a topic named 'test'. Which sequence of commands is correct after starting Zookeeper and Kafka server?
AStart kafka-console-consumer.sh, then create topic with kafka-topics.sh
BOnly start Zookeeper and produce messages directly
CRun kafka-server-start.sh twice, then produce messages
DCreate topic with kafka-topics.sh, then produce messages with kafka-console-producer.sh
Step-by-Step Solution
Solution:
  1. Step 1: Create the topic first

    You must create the topic 'test' before sending messages to it.
  2. Step 2: Use producer to send messages

    After topic creation, use kafka-console-producer.sh to send messages to 'test'.
  3. Final Answer:

    Create topic with kafka-topics.sh, then produce messages with kafka-console-producer.sh -> Option D
  4. Quick Check:

    Create topic then produce = Create topic with kafka-topics.sh, then produce messages with kafka-console-producer.sh [OK]
Quick Trick: Create topic before producing messages [OK]
Common Mistakes:
  • Producing messages before topic creation
  • Starting Kafka server twice unnecessarily
  • Skipping Kafka server start

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes