Critical flow
Contention ends before shipping. What conditions ensure the result?
Two shipments claim 100 available boxes.
Starting point The synchronisation adapter accepts records; the API manages inventory.
Assumptions for the example case
A fictional shipment of 100 boxes of hygiene supplies between a warehouse and a distribution point. Local inventory ownership remains clear; offline devices document assigned shipments. All quantities, thresholds and operational targets in this design are illustrative assumptions.
Duplicate handover synchronisation
Duplicate handover synchronisation
98 accepted and 2 damaged boxes are booked once.
Result: One quantity effect; all 100 remain accounted for.
Committing before responding enables safe replay without a second quantity effect.
Commit, response loss and resumption
- C-49 available 100
- Attempt two allocations of 100 in both arrival orders → One succeeds, the other is rejected; available stock 0.
- U-49 stored with 98/2
- Identical replay, then 99/1 under the same identifier → One quantity effect; the changed replay conflicts.
- S-49 shipped 100
- Receipt totals 99/100/101 → 99 leaves 1 unaccounted for; 100 can be fully accounted for; 101 conflicts without changing quantities.
Resolve competing allocations before dispatch.
Allocation checks and reserves stock atomically.
Two shipments claim 100 available boxes.
A receives 100, B is rejected, available stock 0. B receives 100, A is rejected, available stock 0.
- Alternative considered
- Cleaning up after dispatch is too late.
- Trade-off
- Unsuccessful shipments wait for replenishment.
- Reassess
- Partial allocation needs its own contract.
Try it yourself
Predict both orders and stock.
A hint for your attempt
Two shipments claim 100 available boxes.
Compare with a possible solution
- A first
- A receives 100, B is rejected, available stock 0.
- B first
- B receives 100, A is rejected, available stock 0.
Apply to your project
How does “Resolve competing allocations before dispatch” apply to your own project?