Queueing reverse-vending return events when the store link drops
A return machine in a supermarket is a small edge device with a bad network. Shoppers do not wait for your cloud. If the uplink blips, the machine still has to accept a bottle, print a receipt, and remember that event until the link is back. This note is the shape of that queue, not a product pitch. What has to survive offline Each accepted container is one event, not a row you update in place. A…
Queueing systems in supermarkets face challenges when the store link drops, particularly with return machines that rely on a stable network connection. These machines, typically edge devices with limited network stability, must still accept items, print receipts, and record events locally in the event of network disruptions. The key components of these return events include an event ID, device ID, timestamp, material type, barcode, session ID, and scheme.
The event ID is generated on the device and treated as a no-op if it repeats, which is crucial when the store Wi-Fi delivers the same batch multiple times. A local append-only log should be maintained on disk to ensure durability, with validation of the container (barcode or vision result) before enqueuing. Rejected items do not constitute events and are not recorded.
The receipt printer should only run after successful write operations to ensure that a power cut does not result in lost receipts. Workers process the log when the uplink is restored, sending batches of events in accepted_at order, with the last acked event ID serving as a cursor. The server acknowledges IDs, not the entire request, and drops only the acked prefix, leaving the rest for subsequent attempts.
Clock skew is inherent, and events should be sorted based on both accepted_at (device) and received_at (server) timestamps, allowing for accurate settlement using scheme-specific rules. It is important not to hold the shopper UI on an HTTP call to the cloud, as recognition and receipt printing should occur locally and asynchronously.
Events should not be keyed on barcode and timestamp in seconds, as this can lead to collisions and confusion when retries occur. The on-device log should not be compacted or deleted until the ack is durable to prevent data loss due to a full disk. Vision results, if used for accept/reject decisions, should be included as evidence (vision_label, confidence) within the event, but the initial decision should be made before enqueuing.
Operators managing fleets of these machines typically focus on three main questions: device connectivity, cursor lag, and ack status for sessions. These challenges ultimately represent a queue-depth issue rather than a core recycling problem. The complete return flow, including the queue dynamics, can be found at https://www.recynex.com/news/what-is-a-reverse-vending-machine/.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.