To run the EventProcessor, follow these steps:
- Create the aggregates topic as follows:
$. /bin/kafka-topics --zookeeper localhost:2181 --create --topic
aggregates --replication-factor 1 --partitions 4
- Run a console consumer for the aggregates topic, as follows:
$ ./bin/kafka-console-consumer --bootstrap-server localhost:9092
--topic aggregates --property print.key=true
- From the IDE, run the main method of the EventProducer.
- From the IDE, run the main method of the EventProcessor.
- Remember that it writes to the topic every 30 seconds. The output on the console consumer for the aggregates topic should be similar to the following:
1532529050000 10
1532529060000 10
1532529070000 9
1532529080000 3
After the second window, we can see that the values in the KTable are updated with fresh (and correct) data, shown as follows:
1532529050000 10
1532529060000...