Critical flow
When may ingestion acknowledge a measurement?
The critical sequence connects D-17, BOOT-4, sequence 4711, M-17, W-17 and AL-17. The three scenarios cover normal processing, a duplicate with a late value, and a future device timestamp with a consumer restart.
Starting point Step 6 separates permanent raw log and repeatable projector.
Assumptions for the example case
Example design with 10,000 temperature devices, one value every 10 seconds. An example of a time period ranges from 12:00 to immediately before 12:01. The evaluation will be completed at 12:03 at the earliest. The waiting time of 120 seconds after the end of the time period is an evaluation rule and not a permitted deviation of the instrument clock. Numbers and temperatures are illustrative design assumptions.
Accept M-17 permanently and finalize W-17 in a controlled manner
Critical Process · Participant, Time and Lasting Effect
Four measurements for W-17 are durably accepted. Only the timer 120 seconds after the window ends finalises it and opens AL-17.
- Replayable projector reads the durable ingestion log
Result: Acceptance is durable, the domain effect is replayable, and the alert comes only from a final window with sufficient measurements.
- Gateway and Building Team
- Ingestion and projector
- Separate raw log and result store
A final alert, a duplicate with a late value, and a future device timestamp with consumer restart test the same property: processing remains traceable and produces at most one domain effect.
Three error cases determine the design
- Reconnect and Duplicate
- The same payload for the same key acknowledges the existing acceptance. Different payloads go into quarantine.
- Value after finalisation
- The raw value gets late and remains visible. Final mean and AL-17 remain unchanged.
- Future time and restart
- Quarantine distinguishes device-clock issues from late arrivals. The projector reads its checkpoint and recognises existing result effects.
Terms in this step
- At least once
- A delivery guarantee that permits duplicates. Exactly-once domain effects require the application's own durable keys and updates.
Try it yourself
In the duplicate case, arrange commit, confirmation and window update. Complete the test after a projector crash.
A hint for your attempt
The confirmation must only follow a permanent raw event; the checkpoint follows with the result effect.
Compare with a possible solution
- Acceptance
- Input writes raw value and key, then commits and confirms. Test: Crash before commit does not leave a confirmed message.
- Duplicate
- The same payload finds the existing key. Test: a second PUBLISH increases neither the measurement count nor the alert count.
- Restart
- The projector crashes after committing W-17, AL-17 and the checkpoint but before the success response. On restart, it loads the result store, finds the final result and reuses its measurement count. Expected: one AL-17, an unchanged final mean and no lost progress.
Apply to your project
What is the first irreversible business effect in your critical process?