Bird
0
0

You design a Saga with multiple microservices communicating via Kafka. To ensure scalability and fault tolerance, which approach is best?

hard📝 Application Q15 of 15
Kafka - Event-Driven Architecture
You design a Saga with multiple microservices communicating via Kafka. To ensure scalability and fault tolerance, which approach is best?
AStore Saga state only in a centralized database without event logs
BUse separate Kafka topics per Saga step and implement idempotent consumers
CUse a single Kafka topic for all Saga events without consumer groups
DSend synchronous HTTP calls between services instead of Kafka events
Step-by-Step Solution
Solution:
  1. Step 1: Consider scalability and fault tolerance needs

    Separate topics per step allow independent scaling and isolation of events.
  2. Step 2: Ensure idempotency in consumers

    Idempotent consumers prevent duplicate processing on retries, improving fault tolerance.
  3. Step 3: Evaluate other options

    Single topic without consumer groups limits scalability; centralized DB without events loses Saga benefits; synchronous calls reduce fault tolerance.
  4. Final Answer:

    Use separate Kafka topics per Saga step and implement idempotent consumers -> Option B
  5. Quick Check:

    Separate topics + idempotent consumers = scalable Saga [OK]
Quick Trick: Separate topics and idempotent consumers scale Saga well [OK]
Common Mistakes:
MISTAKES
  • Using one topic for all events limits scaling
  • Ignoring idempotency causes duplicate side effects
  • Relying on synchronous calls reduces fault tolerance

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes