Generate messages to verify the producer and consumer

Perform the following steps to generate messages to verify the producer and consumer:

  1. Send messages to Kafka my-first-topic:
bin/kafka-console-producer --broker-list localhost:9092 --topic my-first-topictest1test2test3
  1. Start consumer to consume messages
  2. Open another terminal and enter the following command:
$ bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic my-first-topic --from-beginningtest3test2test1
  1. Go to the producer terminal and enter another message:
test4
  1. Verify the consumer terminal to check whether you can see the message test4

Get Modern Big Data Processing with Hadoop now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.