Production engineering
Reveal answer and reasoning
Design ordering around one authoritative aggregate sequence, explicit identity equivalence and a deliberate reconciliation path for gaps and poison records. Decide which states are retryable, which require intervention and what evidence callers receive. Preserve replay, changed-input conflict, stale-sequence and gap cases as independent checks. The portable progression explains why last remains one after quarantine; actual SQLite rows establish the implemented local consumer.
A production broker or partition topology introduces additional delivery and retention behavior, which must be tested separately rather than described as guaranteed by a local last-sequence update.
For a distributed deployment, identify who assigns the aggregate sequence and how multiple producers avoid incompatible claims. A consumer transaction can protect local state, but it cannot conjure a missing event or determine a valid business repair by number alone. Choose bounded retries and observability for blocked aggregates, with careful access to poison payloads. Test the approved repair protocol and subsequent eligibility using fresh persisted reads.
Keep global throughput optimization separate from per-aggregate correctness so adding concurrent consumers does not accidentally discard the ordering rule the domain actually requires.
What a strong answer covers
- The console prints gap1, applied1, quarantined, gap2 and applied2.
- Quarantine records failure without advancing the aggregate.
- Actual duplicate, stale and incompatible-id cases are separate from a valid next sequence.
Common pitfall
Treating dead-letter storage as success or assuming one local sequence establishes a broker-wide total order.
Follow-up questions
- Who assigns a sequence when several producers exist?
- What evidence and authority should a repair or skip operation require?
Self-review
Choose what to revisit. These marks are your own assessment and are separate from lesson completion.