Change commands and retries
Why can't duplicate deliveries count as several minutes of measurement?
Scale alone does not ensure consistent retry behaviour. This proposed API binds the role, business object, change payload and expected state to each new intent. An idempotency key identifies the same intent after a response is lost.
Starting point Test 2,000 measurements/s as a catch-up profile.
Assumptions for the example case
This fictional worked design assumes a bounded metering zone, minute-by-minute flow readings, manual confirmation of findings and one active repair order per confirmed finding. Numbers and quality targets are illustrative test assumptions. Automatic valve control, full hydraulic simulation and drinking water quality assessment are outside scope.
Retries and new intent
Sequence keys and offline proof of work
Identical sequences and repair events act once; altered readings for the same sequence end up in quarantine.
Proposed domain API contracts
- POST
/flow-observationsDurably accept a flow measurement.
- Input
- Authenticated M-111, sequence, measurement time, litres/min, quality and assignment version for N-111.
- Result
- One measurement per sequence; identical repetition counts once, other payload goes into quarantine.
- Retry behaviour
- An identical operation by the same authorised role on the same object, using the same key and canonical payload, returns the stored original result. A changed payload under that key is rejected. External result identifiers are durably deduplicated after authentication; new intents check the current version again.
- POST
/leak-findingsConfirm an investigated suspected leak.
- Input
- Control room, V-111, investigation evidence, location, justification, expected version and key.
- Result
- B-111 as a confirmed finding; a raw alarm alone does not satisfy the contract.
- Retry behaviour
- An identical operation by the same authorised role on the same object, using the same key and canonical payload, returns the stored original result. A changed payload under that key is rejected. External result identifiers are durably deduplicated after authentication; new intents check the current version again.
- POST
/leak-findings/{id}/repair-ordersAssign an active repair job.
- Input
- Control room, B-111, responsible field service team and key.
- Result
- R-111 or existing active assignment; parallelism does not generate a second order.
- Retry behaviour
- An identical operation by the same authorised role on the same object, using the same key and canonical payload, returns the stored original result. A changed payload under that key is rejected. External result identifiers are durably deduplicated after authentication; new intents check the current version again.
- POST
/repair-orders/{id}/work-evidenceSubmit actual work recorded offline.
- Input
- Field service, R-111, device event, work time, action taken and evidence.
- Result
- One work record and state repariert; closure awaits post-repair inspection.
- Retry behaviour
- An identical operation by the same authorised role on the same object, using the same key and canonical payload, returns the stored original result. A changed payload under that key is rejected. External result identifiers are durably deduplicated after authentication; new intents check the current version again.
- POST
/repair-orders/{id}/verificationConfirm restoration based on domain evidence.
- Input
- Authorised control room, post-repair inspection period, measurement evidence, R-111 and justification.
- Result
- State abgeschlossen with reliable evidence, or nacharbeit when the finding persists.
- Retry behaviour
- An identical operation by the same authorised role on the same object, using the same key and canonical payload, returns the stored original result. A changed payload under that key is rejected. External result identifiers are durably deduplicated after authentication; new intents check the current version again.
- GET
/repair-orders/{id}Read outstanding repair and post-repair inspection status.
- Input
- Control room or field service authorised for this object.
- Result
- Work evidence, measurement references, ownership and missing closure evidence.
- Retry behaviour
- Repeating a read creates no business effect; the returned current state may change between requests.
Deduplicate the sequence
Use the station and sequence as a stable measurement identity.
A high value is delivered three times.
One measurement does not satisfy a sequence of three.
- Alternative considered
- Counting messages instead of measurements generates false alarms.
- Trade-off
- The device contract must guarantee sequence identity.
- Reassess
- Replacing the station changes its identity.
Terms in this step
- Deduplicate the sequence
- One measurement does not satisfy a sequence of three.
Try it yourself
A station sends the same high value three times. Count valid minute values and set the alarm.
A hint for your attempt
Use the specific entities and conditions from this step. The two solution parts distinguish the decision from its evidenced outcome.
Compare with a possible solution
- First part of the solution
- Station and sequence identify a measurement; three deliveries count as one value.
- Second part of the solution
- One high reading does not satisfy the three-reading sequence. A different payload under the same sequence is quarantined.
Apply to your project
Which corresponding assumption in your project would you check first? Consider this trigger: Replacing the station changes its identity.