System Design Atlas

Waste collection routes and disposal records

07 / 10Worked example

Critical flow

What evidence remains for the collection route after a response is lost, and what may happen next?

The architecture is now tested at its critical failure point. The device sends a locally stored bin-emptying record. The collection route API checks the route-and-bin assignment and event identity, then acknowledges only after commit. A second report with a different mass is stored as a discrepancy; the receiving facility later confirms the actual total load.

Starting point Synchronisation is separate from finalising the evidence.

Assumptions for the example case

Original fictional example design. A municipal collection service for non-hazardous waste uses its own operational records and confirmed handovers. The illustrative load limit is 10000 kg; additional planned loading is allowed only if total mass remains ≤ 10000 kg. All figures and test targets are illustrative assumptions.

Critical flow with commit and failure point

Critical flow

1
Vehicle with local journal → Device synchronisationSigned event sequence
2
Device synchronisation → Collection route APIDeduplicated emptying
3
Collection route API → Relational assignment storeBin outcome
4
Receiving facility → Record completionWeighing and handover record
5
Relational assignment store → Record completionCollection evidence chain

Each emptying takes effect once per bin and route. Completion requires a handover record and resolved discrepancies.

The device sends a locally stored bin-emptying record. The collection route API checks the route-and-bin assignment and event identity, then acknowledges only after commit. A second report with a different mass is stored as a discrepancy; the receiving facility later confirms the actual total load.

Ordering and failure outcomes

Required order
The device sends a locally stored bin-emptying record. The collection route API checks the route-and-bin assignment and event identity, then acknowledges only after commit. A second report with a different mass is stored as a discrepancy; the receiving facility later confirms the actual total load.
Crash before commit
No new durable evidence exists yet for collection route T-38. The same command may be checked again; unconfirmed intermediate work provides no business guarantee.
Crash after commit, before response
The command journal entry records the original result. Identical replay returns that evidence; a fresh view of the current state comes from the read contract.
External uncertainty
Without a response from the receiving facility, the outcome remains unknown. Confirmed acceptance, definite rejection and missing evidence have separate states. The responsible domain role investigates using the same reference.

Acknowledgement follows durable acceptance of the emptying record

Acknowledgement follows durable acceptance of the emptying record

Acknowledgement follows durable acceptance of the emptying record.

The device sends a locally stored bin-emptying record. The collection route API checks the route-and-bin assignment and event identity, then acknowledges only after commit. A second report with a different mass is stored as a discrepancy; the receiving facility later confirms the actual total load.

Each confirmed emptying takes effect once for the same bin and route work order. Completing a route requires documented handover status and resolved discrepancies. The exercise specifies the input and expected result.

Alternative considered
Submitting a new request after a response is lost can execute the same business operation again.
Trade-off
Outstanding evidence from the receiving facility requires a work list.
Reassess
Frequent unresolved outcomes require a more reliable contract for external reconciliation.

Try it yourself

Mark the commit point, failure point and next permitted action. Explain the effect of an identical retry.

A hint for your attempt

Trace the same request through the datastore and response path.

Compare with a possible solution
Flow and failure
The device sends a locally stored bin-emptying record. The collection route API checks the route-and-bin assignment and event identity, then acknowledges only after commit. A second report with a different mass is stored as a discrepancy; the receiving facility later confirms the actual total load.
Commit and replay
The business change and command result are stored together before the response. If the response is lost after commit, the caller reads this result. Collection route T-38 receives no second effect.

Apply to your project

What feedback could be missing even though the underlying action has already taken place?

Next: mass discrepancies and coverage gaps require different checks.