Bird
Raised Fist0

You want to implement a Kafka producer that writes messages exactly once to multiple partitions atomically. Which combination of settings and steps is required to achieve this?

hard🚀 Application Q15 of Q15
Kafka - Message Delivery Semantics
You want to implement a Kafka producer that writes messages exactly once to multiple partitions atomically. Which combination of settings and steps is required to achieve this?
ADisable idempotence, send messages asynchronously, then flush producer
BSet acks=0, send messages to partitions, then close producer
CEnable idempotence, initialize and begin transactions, send messages, then commit transaction
DUse synchronous sends without transactions and rely on consumer deduplication
Step-by-Step Solution
Solution:
  1. Step 1: Identify EOS requirements for atomic writes

    Enable idempotence and use transactions to ensure atomic writes across partitions.
  2. Step 2: Follow correct transaction steps

    Initialize transactions, begin transaction, send messages, then commit transaction to finalize.
  3. Step 3: Evaluate other options

    Options B, C, and D lack idempotence or transactions, so they cannot guarantee exactly-once atomic writes.
  4. Final Answer:

    Enable idempotence, initialize and begin transactions, send messages, then commit transaction -> Option C
  5. Quick Check:

    Idempotence + transactions = atomic exactly-once writes [OK]
Quick Trick: Use idempotence + transactions for atomic exactly-once writes [OK]
Common Mistakes:
MISTAKES
  • Ignoring transaction lifecycle steps
  • Relying on consumer deduplication only
  • Disabling idempotence for performance

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes