To run the EventProducer, we follow these steps:
- Create the events topic, as shown in the following block:
$. /bin/kafka-topics --zookeeper localhost:2181 --create --topic
events --replication-factor 1 --partitions 4
- Run a console consumer for the events topic using the following command:
$ ./bin/kafka-console-consumer --bootstrap-server localhost:9092
--topic events
- From the IDE, run the main method of the EventProducer.
- The output on the console consumer for the events topic should be similar to the following:
1532529060000,47, on time
1532529060000,48, on time
1532529060000,49, on time
1532529070000,50, on time
1532529070000,51, on time
1532529070000,52, on time
1532529070000,53, on time
1532529070000,55, on time
1532529070000,56, on time
1532529070000,57, on time
1532529070000,58, on time
1532529070000,59, on time
1532529080000,0, on time
1532529080000...