Give the operation a stable identity
How stable operation keys, atomic execution records, and recovery of uncertain outcomes prevent duplicate side effects across concurrent deliveries and delayed replays. · advanced
A stable operation key names one intended business action, not one execution attempt. For a balance adjustment, a key could be tenant/account/adjustment-id. Concurrent deliveries and delayed replays of that adjustment must preserve the same key. A genuinely new adjustment needs a new identifier, even when its amount is identical.
Store a request fingerprint with the key, calculated from canonical business parameters such as account, amount, and currency. Exclude delivery timestamps, worker identifiers, and other attempt metadata. If an existing key arrives with a different fingerprint, reject the conflict rather than returning an unrelated result or performing another adjustment.
Choose the key's scope deliberately. An account identifier alone suppresses legitimate later adjustments; a random identifier generated on every attempt permits duplicates. Preserve the operation identifier through redrives and replay tooling, rather than relying on transport identifiers that those paths may replace.