Interfaces
How does the Report routine work contract distinguish a retry from new intent?
The load profile leads to the concrete command “Report routine work”. Its payload includes device, work order revision, local event number, actual action time and report. An idempotency key recognises the same intent after a response is lost; an aggregate version protects the changing business state.
Starting point Reconnection determines the peak load profile.
Assumptions for the example case
A fictional example design for offline documentation of previously authorised routine work, with separate safety procedures. Zone information is marked stale from age 300 seconds; this does not authorise entry or work. All figures and test targets are illustrative assumptions.
Commands, retries and current state
Command and historical result
Identical replay returns the stored record; changed content produces a conflict.
Proposed API for this example
- POST
/bergwerksbetrieb/{id}/commandsReport routine work
- Input
- Device, work order revision, local event number, actual action time and report; 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
/bergwerksbetrieb/{id}Read the current business state and reason for investigation.
- Input
- Authorised identity and business object.
- Result
- Work order with its current version, evidence and reason for outstanding processing.
- Retry behaviour
- Repeating a read creates no business change; access is checked again.
Additional state changes
| Operation | Input | Result and protection |
|---|---|---|
| Assignment | Shift supervisor, device, revision and routine-work description | The work order is marked as known to the device only after receipt is acknowledged. |
| Synchronise reports | Device, event sequence, content and last acknowledgement | Accept each report durably; keep gaps and contradictions visible. |
| Cancel a work order | Shift supervisor, version and delivered cancellation | Terminal only with evidence that cancellation was known before execution; otherwise open an investigation case. |
| Complete reconciliation | Shift supervisor, actual outcome and original evidence | abgeglichen or klärfall → abgeschlossen. |
Assignment
- Input
- Shift supervisor, device, revision and routine-work description
- Result and protection
- The work order is marked as known to the device only after receipt is acknowledged.
Synchronise reports
- Input
- Device, event sequence, content and last acknowledgement
- Result and protection
- Accept each report durably; keep gaps and contradictions visible.
Cancel a work order
- Input
- Shift supervisor, version and delivered cancellation
- Result and protection
- Terminal only with evidence that cancellation was known before execution; otherwise open an investigation case.
Complete reconciliation
- Input
- Shift supervisor, actual outcome and original evidence
- Result and protection
- abgeglichen or klärfall → abgeschlossen.
Messages across the external boundary
- Source contract
- NIOSH treats underground communication and tracking as distinct technical and safety responsibilities. This case practises synchronising routine-work documentation.
- System responsibility
- After a connection interruption, the gateway resends events. The API stores the report and validation result before acknowledging it. A gap in the device sequence keeps completion open; the shift supervisor receives the conflicting work-order state together with the original report.
Each device has its own event namespace
Each device has its own event namespace.
Report routine work may re-arrive after a lost response.
Device, work order revision, local event number, actual action time and report 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 routine work requires durable retention and protected access.
- Reassess
- The documented retry window and journal volume determine the future archiving strategy.
Try it yourself
For Report routine work, predict the outcomes of an identical retry, the same key with a changed activity report, and a new key with a stale version.
A hint for your attempt
Retry identity and current state require separate checks.
Compare with a possible solution
- Identical
- The saved result for work order A-35 is returned; the 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?