Run this before class. Have Web UI open at http://localhost:8081
Walk through this slowly — it's the most complex code of the week. One timer per window: registering on the FIRST tx (cur==1) means exactly one timer fires 60s later and resets the count. The lab's FraudDetector uses ListState of timestamps for a true sliding window — this single-timer pattern is simpler but counts from the first event in each window, not a rolling 60-second lookback.
~10 minutes
~20 minutes
Key observation: batch counter in Web UI picks up where it left off, not from 0.
Answers: 1=RocksDB (disk-backed, handles large state); 2=60 seconds of reprocessing; 3=what latency is required? < 100ms → Flink, otherwise Spark may suffice; 4=you get at-least-once; must make the sink idempotent (upsert by id, dedup table)