Bird
0
0

You want to implement a Kafka CQRS system where commands trigger events that update multiple read models asynchronously. Which approach best supports this?

hard📝 Application Q8 of 15
Kafka - Event-Driven Architecture
You want to implement a Kafka CQRS system where commands trigger events that update multiple read models asynchronously. Which approach best supports this?
ASend all events to a single topic and have one query handler update all read models
BUse separate event topics for each read model and have query handlers subscribe accordingly
CCombine commands and events in one topic to simplify processing
DUse only commands topic and update read models directly in command handler
Step-by-Step Solution
Solution:
  1. Step 1: Understand asynchronous updates in CQRS

    Events represent state changes and can be consumed by multiple query handlers independently.
  2. Step 2: Design for multiple read models

    Using separate event topics per read model allows independent scaling and decoupling.
  3. Final Answer:

    Use separate event topics for each read model and have query handlers subscribe accordingly -> Option B
  4. Quick Check:

    Separate event topics enable async updates [OK]
Quick Trick: Separate event topics for each read model improve scalability [OK]
Common Mistakes:
  • Combining commands and events in one topic
  • Using single query handler for all models
  • Updating read models in command handler

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes