Interfaces
How does the report-emptying contract distinguish a retry from a new intent?
The load profile now applies to the specific command “report emptying”. Its payload contains the route, bin, device event, action time and reported mass. An idempotency key recognises the same intent after a response is lost; an aggregate version protects the business state against concurrent changes.
Starting point Reconnection determines peak processing load.
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.
Commands, retries and current state
Command and replay
Identical content returns the same record; changed content produces a conflict.
Proposed API for this example
- POST
/abfalltouren/{id}/commandsReport emptying
- Input
- Route, bin, device event, action time and reported mass; expected aggregate version, authorised role and stable command key.
- Result
- Durably stored business result and new version; version or content conflicts produce no partial effects. An accepted external request receives an open status.
- Retry behaviour
- The key is scoped to the actor, operation and business object. After authentication, first compare the existing result and canonical content: identical content returns the stored evidence; changed content produces a conflict. Only new keys trigger validation of the current version.
- GET
/abfalltouren/{id}Read the current business state and reason for investigation.
- Input
- Authorised identity and business object.
- Result
- Collection route with its current version, evidence and reason for pending work.
- Retry behaviour
- Repeating a read creates no business change; access is checked again.
Additional state changes
| Operation | Input | Result and protection |
|---|---|---|
| Report a bin exception | Collection team, route, bin and actual reason | The bin work order records an exception instead of an emptying. |
| End collection | Collection team, version and a complete set of bin outcomes | unterwegs → übergabe_offen; all unresolved bin outcomes must be explicitly resolved. |
| Accept the load | Receiving facility, route/load, weighing record and mass | Matching record → übergeben; differing assignment or mass → klärfall. |
| Complete the chain of evidence | Records officers, handover and resolved exceptions | übergeben or resolved klärfall → abgeschlossen; the completion record remains immutable. |
Report a bin exception
- Input
- Collection team, route, bin and actual reason
- Result and protection
- The bin work order records an exception instead of an emptying.
End collection
- Input
- Collection team, version and a complete set of bin outcomes
- Result and protection
- unterwegs → übergabe_offen; all unresolved bin outcomes must be explicitly resolved.
Accept the load
- Input
- Receiving facility, route/load, weighing record and mass
- Result and protection
- Matching record → übergeben; differing assignment or mass → klärfall.
Complete the chain of evidence
- Input
- Records officers, handover and resolved exceptions
- Result and protection
- übergeben or resolved klärfall → abgeschlossen; the completion record remains immutable.
Messages across the external boundary
- Source contract
- ZKS-Abfall describes unique identifiers for formal waste records. This case uses its own operational records and does not claim eANV compliance.
- System responsibility
- 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.
A device event identifies its route and bin
A device event identifies its route and bin.
A report-emptying command may arrive again after a response is lost.
The route, bin, device event, action time and reported mass must remain identical on replay. The exercise specifies the input and expected result.
- Alternative considered
- A key stored only in volatile memory loses its evidence on restart.
- Trade-off
- The journal for report-emptying commands requires durable retention and protected access.
- Reassess
- The documented retry window and journal volume determine the future archiving strategy.
Try it yourself
Predict the results of an identical report-emptying retry, the same key with a different mass, and a new key with an old version.
A hint for your attempt
Retry identity and current state require separate checks.
Compare with a possible solution
- Identical
- The stored result for collection route T-38 is returned; its effect is not repeated.
- Changed
- The same key with altered canonical content results in conflict.
- New intent with a stale version
- A new key with a stale version is rejected before any business change. The interface reloads the current state and asks the user to confirm the decision again.
Apply to your project
Which input fields make two change intentions different in your project?