Brief
Link source, event time, watermark, window, state, and checkpoint in a streaming stop-and-restart test.
Voss enters with a graph that omits OPEN-18. Mara starts the practice laboratory while Imani places the late message on the table. Explain each stage and how you would check the result if the engine stops halfway. The meeting is near in the story; the exercise has no timer.
Your mission
- Draw topic Kafka → event time → watermark → window → report.
- Put E1 and E2 in their windows and calculate the watermark when E2 arrives.
- Give a stop-and-restart test using a confirmed checkpoint and an uninterrupted comparison.
- Name what this lab cannot yet prove about the sink, clock, and SUPPLIER-SVC.
How to check your work
- Source and calculation in the right order.
- E1 in [21:00,21:10), E2 in [21:10,21:20), watermark 21:05 when E2 arrives.
- Confirmed checkpoint, stop, restore, command and report comparison.
- External sink, clock, and human identity still require verification.
Course example
from datetime import datetime, timedelta
def at(hm): return datetime.fromisoformat("2026-04-12T"+hm+":00+00:00")
events=[
{"id":"E1","kind":"gate","command":"OPEN-17","at":at("21:05"),"received":at("21:07")},
{"id":"CRASH","kind":"signal","command":None,"at":at("21:25"),"received":at("21:26")},
{"id":"E2","kind":"gate","command":"OPEN-18","at":at("21:18"),"received":at("21:36")},
{"id":"HEARTBEAT","kind":"progress","command":None,"at":at("21:45"),"received":at("21:46")},
]
seen=set()
buckets={}
max_event=None
for e in sorted(events,key=lambda row:row["received"]):
max_event=e["at"] if max_event is None else max(max_event,e["at"])
watermark=max_event-timedelta(minutes=20)
if e["kind"]=="gate" and e["command"] not in seen:
seen.add(e["command"])
start=e["at"].replace(minute=(e["at"].minute//10)*10,second=0)
buckets.setdefault(start,[]).append(e["command"])
print(e["id"],"watermark",watermark.strftime("%H:%M"))
print("gate_windows",[(k.strftime("%H:%M"),v) for k,v in sorted(buckets.items())])
print("distinct_commands",len(seen))