# Senior Kafka playbook

Compressed reference for the senior-only Kafka extension. Pair with [cheat-sheet.md](./cheat-sheet.md), [GLOSSARY.md](./GLOSSARY.md), and [repo-kafka-map.md](./repo-kafka-map.md).

## The senior shift
Intermediate understanding is: "I know topics, partitions, groups, offsets, `acks`, strict vs `AlwaysCommit()`, retries, ISR, retention, and how our services use the wrapper."

Senior understanding is: "I can reason about partition strategy, lag and rebalance cost, event-contract safety, retry vs DLQ choices, and whether a Kafka design is making truthful reliability claims."

## Six senior lenses
1. **Partitions are workload design** — not just a scaling number.
2. **Lag is a symptom** — diagnose the actual cause behind stalled progress.
3. **Contracts outlive deploys** — event-schema evolution is distributed compatibility work.
4. **Retries need a theory** — not every failure should be retried in place.
5. **DLQ is about liveness plus evidence** — not just “save bad messages somewhere.”
6. **Review is about guarantee truthfulness** — ask what the design really guarantees and what it trades away.

## Senior review checklist
- Can you explain why this partition count and key choice fit the workload?
- Can you distinguish throughput shortage from hotspot or stuck-partition lag?
- Can you describe how payload changes stay backward-safe in JSON event flows?
- Can you justify retry-in-place versus retry-topic versus DLQ behavior?
- Can you explain the real meaning of `RequireOne` and `AlwaysCommit()` here?
- Can you spot when a design is using Kafka vocabulary more confidently than its guarantees deserve?

## Interview answer shapes
### Why not always add more partitions?
Because throughput pressure may come from skewed keys or ordering constraints; more partitions only help if the traffic can actually spread safely.

### What does lag really mean?
Offsets are not advancing as fast as records arrive; the real cause may be under-capacity, a slow handler, repeated rebalances, or one blocked partition.

### Why is JSON event evolution risky?
Because producer and consumer deploy independently, so payload changes are distributed-contract changes even inside one monorepo.

### What is the real point of a DLQ?
Preserve failed-message evidence and allow the original partition to keep progressing instead of stalling healthy work behind a poison message.

### What is the real job of a senior Kafka reviewer?
To ask what exact guarantees the design provides about durability, ordering, replay, and liveness, and whether the claimed trade-offs match the implementation.
