Bird
0
0

Given this Kafka setup for CQRS:

medium📝 Predict Output Q13 of 15
Kafka - Event-Driven Architecture
Given this Kafka setup for CQRS:
commands_topic = ['CreateOrder', 'UpdateOrder']
events_topic = ['OrderCreated', 'OrderUpdated']

Which topic should a read service subscribe to for query data?
Acommands_topic
BBoth commands_topic and events_topic
Cevents_topic
DNeither, it reads directly from the database
Step-by-Step Solution
Solution:
  1. Step 1: Identify read service role

    Read services in CQRS listen to events that represent state changes, not commands which are requests.
  2. Step 2: Match topic to read service

    Events_topic contains 'OrderCreated' and 'OrderUpdated' which reflect changes; read service subscribes here.
  3. Final Answer:

    events_topic -> Option C
  4. Quick Check:

    Read service subscribes to events_topic [OK]
Quick Trick: Reads listen to events, not commands [OK]
Common Mistakes:
  • Subscribing read service to commands_topic
  • Subscribing to both topics unnecessarily
  • Assuming reads bypass Kafka

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes