~3 pages. Each pattern entry needs a code citation (
file:line). No citation = no marks.
Identify and explain each pattern below as it appears in the starter code.
- Where: trace events from
sos-service/app/main.py→dispatch-service/app/main.py→notification-service/app/main.py - Compensation step: where, and what state is rolled back?
- What event is the rollback trigger?
- Where:
app/events.pyin every service (aiokafkaproducer + consumer) - Consumer group semantics: explain at-least-once + how manual
await consumer.commit()AFTER handler success preserves the invariant (auto-commit is disabled) - Partition keying: explain why
publish(..., key=incident_id)matters for the saga (same-key events → same partition → ordering)
- Where:
app/db.pyin every service - Why: what would break if we let route handlers query SQLite directly?
- Where:
dispatch-service/app/matching.py - How to switch: environment variable
MATCHER - Add a third strategy (e.g. round-robin) and cite the lines you added
- Where:
sos-service/app/main.pytrigger() - Why is this "lite"? What would a real Outbox add?
- Where:
events.pyclass CircuitBreaker - Task: complete the
allow()state machine (CLOSED → OPEN → HALF_OPEN) and cite the lines you added. - Explain what triggers state transitions in your impl.
For each pattern:
- Pattern name (GoF, EAA, or Cloud-Native catalogue)
- Where you added it (
file:line) - Problem it solves in HELEP
- Trade-off vs alternative pattern
Briefly call out one anti-pattern the architecture explicitly avoids (e.g. shared database across services, distributed monolith, synchronous fan-out) and cite the file that demonstrates the avoidance.
Submit as patterns.pdf. Keep code excerpts ≤ 10 lines.