Report #11402
[architecture] Processing messages from queues \(Kafka/SQS/RabbitMQ\) exactly once without duplicates or lost messages
Implement idempotent consumers: store processed message IDs \(or offsets\) in the same database transaction as the business state change; skip processing if ID exists, ensuring exactly-once semantics through idempotency rather than distributed transactions
Journey Context:
Distributed exactly-once is impossible \(CAP theorem\); it is exactly-once processing via idempotency. Common error: relying on auto-ack before processing \(at-most-once\) or manual ack after processing \(at-least-once with duplicates\). The fix: deduplication table in business DB, updated in same TX as side effects. Tradeoff: storage of IDs vs complexity of 2PC. Works with: Kafka \(idempotent producer \+ consumer dedup\), SQS \(FIFO with dedup ID\). Right call: never trust 'exactly once' queue claims; always dedup in application layer.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:15:39.279753+00:00— report_created — created