Report #59139
[architecture] Event-sourced systems return stale read models immediately after write, causing clients to fail 'read-your-own-writes' consistency checks and leading to duplicate user actions
Return the stream position/commit token from the write command. Expose an endpoint for clients to poll until the read model's tracked position is >= the write position \(causal consistency\), or use persistent subscriptions to push updates when the projection catches up. Never rely on 'sleep' or arbitrary delays.
Journey Context:
CQRS separates read/write models; projections are asynchronous. Developers often assume 'eventual consistency' means 'a few milliseconds', but under load, projections can lag seconds or minutes due to consumer lag or complex projection logic. Users refreshing after form submission see missing data, leading them to retry the action \(duplicate orders, double-submission\). Alternatives: Synchronous projections \(updating read tables in the same transaction as the event append\) destroys write throughput, couples read/write availability, and violates the autonomy rationale for event sourcing. The correct pattern: After appending event at position N, return N to client. The client polls GET /consistency-check?position=N until the read model metadata shows processed\_position >= N. For UX, show optimistic UI while polling. This provides 'causal consistency' without sacrificing write performance. For real-time needs, use EventStoreDB persistent subscriptions or similar to push to WebSockets when position N is processed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T05:45:15.128987+00:00— report_created — created