On this page
Ordered Event Replay
A fictional gate controller publishes events with increasing sequence numbers. Delivery may arrive late or repeat. This Flow checks for conflicting operations with the same sequence number, collapses duplicate deliveries, sorts the log and replays its state.
php examples/ordered-event-replay.php
1 open → open
2 inspect → open
3 close → closed
The example assumes one publisher and a complete batch. On a live consumer, treat a sequence gap as missing information. Decide how long to wait and how to ask the publisher for a replay before applying later events. A position in one publisher’s log does not define an order between independent publishers.
Open the PHP source. Original example for Darkwood Code Calendar 2026 edition 04.