Apply window
transformation on KStreams
20 mins
File : src/main/java/x/lab07_streams/StreamsConsumer5_Window.java
This consumer will apply the following transformation to a KafkaStream
- map the incoming record into key value pair with (action,1)
- aggregate all actions by
- groupby action
- and counting them
=> Inspect the file and fix the TODO items.
Run the lab07_streams/StreamsConsumer5_Window
in Eclipse
Run the utils.ClickStreamProducer
in Eclipse
Expected output
....
[KTABLE-TOSTREAM-0000000009]: clicked, 13
[KTABLE-TOSTREAM-0000000009]: blocked, 7
[KTABLE-TOSTREAM-0000000009]: viewed, 3
[KTABLE-TOSTREAM-0000000009]: clicked, 14
[KTABLE-TOSTREAM-0000000009]: blocked, 8
[KTABLE-TOSTREAM-0000000009]: clicked, 15
[KTABLE-TOSTREAM-0000000009]: blocked, 9
[KTABLE-TOSTREAM-0000000009]: clicked, 16
[KTABLE-TOSTREAM-0000000009]: clicked, 17
[KTABLE-TOSTREAM-0000000009]: blocked, 10
Run the utils.ClickStreamProducer
in Eclipse
Notice the counts, what do you see?