Paths Subjects Questions Quizzes Pricing Search
Advanced Open Pro

Exactly-Once Payment Capture Under Redelivery

A consumer reads CapturePayment{order_id, amount} messages from a Kafka topic and calls a third-party payment gateway. During an incident you find that 40 customers were charged twice. Logs show the consumer committed offsets after each batch of 100 messages, and one pod was OOM-killed mid-batch.

  1. Explain step by step how the double charge happened.
  2. A colleague proposes "turn on Kafka exactly-once semantics (enable.idempotence=true and transactions)". Will that fix it? Why or why not?
  3. Design a fix that guarantees each order is charged at most once even if the message is delivered five times. State exactly where the deduplication state lives and what happens on a crash between the gateway call and the database write.

Share this question

← Back to Message Queues & Event Streaming practice

We use cookies for product analytics to improve OmniAtlas. See our Privacy Policy.