DELIVERY GUARANTEES
The ack got lost.
He paid twice.
BOTH BROKERS SENT IT TWICE
A lost ack looks like a lost job. So the broker sends it again.
AT-LEAST-ONCE REDELIVERED
BROKER
sends twice
HANDLER
runs it again
LEDGER
paid twice
It already ran, so it runs again and the card is charged twice.
IDEMPOTENCY KEY DEDUPED
BROKER
sends twice
HANDLER
seen this key
LEDGER
paid once
The duplicate still arrives, but the gate has seen this key.
AT-LEAST-ONCE — the duplicate runs.
Your side effect happens twice.
IDEMPOTENCY KEY — the duplicate
arrives and does nothing.
The ack got lost.
He paid twice.
Check this before
you take money.