Harmless repetition can still produce the wrong state
Why making repeated processing harmless does not make out-of-sequence processing correct, and when applications require both properties. · advanced
Idempotency concerns repeating one logical operation: applying it again does not change its intended effect. Ordering concerns the relative sequence of distinct operations. For a state transformation f, idempotency means f(f(s)) = f(s). That says nothing about whether another transformation may safely run before or after it.
Consider two subscription events: version 11 sets the status to ACTIVE, and version 12 sets it to CANCELLED. Each assignment is idempotent. Applying version 12 and then version 11 nevertheless leaves the subscription incorrectly ACTIVE. Both events were processed exactly once, so even perfect duplicate suppression would not prevent this error.
The relevant boundary is where the required business effects become visible. Receiving events in order is insufficient if parallel workers commit their changes in reverse order. Conversely, making each worker retry-safe does not establish a correct sequence between different workers' changes.
| Property | Constrains | Does not establish |
|---|---|---|
| Idempotency | Repeated logical operation | Sequence of distinct operations |
| Ordering | Relative sequence of effects | Harmless repeated effects |