Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 1.32 KB

07.6-streaming-window.md

File metadata and controls

57 lines (37 loc) · 1.32 KB

<< back to main index

Lab 7.6: Kafka Streaming - Window

Overview

Apply window transformation on KStreams

Depends On

7.1 streaming intro

Run time

20 mins

Step 1: Streaming Consumer 5

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

Step 3: Run Producer

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

Step 4: Run Producer Again

Run the utils.ClickStreamProducer in Eclipse

Notice the counts, what do you see?