Bird
0
0

You notice that your Saga implementation using Kafka sometimes processes compensation events before the original transaction events. What is the likely cause?

medium📝 Debug Q6 of 15
Kafka - Event-Driven Architecture
You notice that your Saga implementation using Kafka sometimes processes compensation events before the original transaction events. What is the likely cause?
AThe consumer group is configured with too many instances.
BKafka topic partitions are not keyed by transaction ID, causing out-of-order processing.
CCompensation events are published to a different Kafka cluster.
DKafka automatically reorders messages randomly.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze message ordering in Kafka

    Kafka guarantees order only within partitions keyed by the same key.
  2. Step 2: Cause of out-of-order compensation

    If messages are not keyed by transaction ID, they may go to different partitions and be processed out of order.
  3. Final Answer:

    Kafka topic partitions are not keyed by transaction ID, causing out-of-order processing. -> Option B
  4. Quick Check:

    Out-of-order events = wrong partition key [OK]
Quick Trick: Use transaction ID as key to maintain order [OK]
Common Mistakes:
MISTAKES
  • Assuming Kafka reorders messages randomly
  • Blaming consumer group size
  • Thinking different clusters cause ordering issues

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes