advancedKafka397 of 469
A consumer processes a message and saves to the DB, but crashes before committing the offset. What does the next consumer see, and how do you avoid duplicate effects such as double billing?
Tests whether you know the message will be redelivered since the offset was never committed, so the only real fix is making the DB write idempotent (e.g. a unique constraint on a message ID) -- at-least-once delivery is unavoidable, exactly-once processing has to be engineered at the consumer.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response