flowchart LR accTitle: A lost reply, a safe retry accDescr: Sequence between a caller, an order service, its ledger with an outbox table, and an ERP. One: the caller posts an order with request key K. Two: the service writes the order and its outbound message in one database transaction. Three: the 201 Created reply is lost in transit. Four: the caller times out and retries with the same key. Five: the service finds key K and creates no second order. Six: it returns the original result. Seven: a relay delivers the outbound message to the ERP at least once. Eight: the ERP acknowledgement closes the outbox row. The oldest open row is the figure an operator watches. %% ref-retry (en) %% https://www.thebsq.com/capabilities/engineering-m2m %% n_request — One: the caller posts an order with request key K. n_request["Order with key K"] %% n_write — Two: the service writes the order and its outbound message in one database transaction. n_write["Order and outbox"] %% n_lost — Three: the 201 Created reply is lost in transit. n_lost["Lost response"] %% n_repeat — Four: the caller times out and retries with the same key. n_repeat["Use the same key"] %% n_existing — Five: the service finds key K and creates no second order. n_existing["Find the committed order"] %% n_original — Six: it returns the original result. n_original["Original response"] %% n_relay — Seven: a relay delivers the outbound message to the ERP at least once. n_relay["At-least-once delivery"] %% n_ack — Eight: the ERP acknowledgement closes the outbox row. n_ack["ERP acknowledgement"] %% n_monitor — The oldest open row is the figure an operator watches. n_monitor["Oldest outstanding event"] n_request -->|"commits one transaction"| n_write n_write -->|"response fails in transit"| n_lost n_write -->|"outbox row survives lost reply"| n_relay n_lost -->|"caller reaches its timeout"| n_repeat n_repeat -->|"looks up K"| n_existing n_existing -->|"replays the stored result"| n_original n_relay -->|"recipient confirms receipt"| n_ack n_relay -->|"no acknowledgement yet"| n_monitor n_monitor -->|"retries outstanding delivery"| n_relay %% Recover the lost response — n_request → n_write → n_lost → n_repeat → n_existing → n_original %% Reconcile the ERP event — n_write → n_relay → n_monitor → n_relay → n_ack