Bird
0
0

You want to build a real-time dashboard that shows the current count of active users using Kafka Streams interactive queries. Which approach best fits this requirement?

hard📝 Application Q15 of 15
Kafka - Advanced Stream Processing

You want to build a real-time dashboard that shows the current count of active users using Kafka Streams interactive queries. Which approach best fits this requirement?

AWrite user statuses to a separate database and query it periodically
BStore counts in a local variable updated by Kafka Streams processors
CUse Kafka consumer to read all user status events and aggregate externally
DUse a <code>ReadOnlyKeyValueStore</code> to store user statuses and query counts live
Step-by-Step Solution
Solution:
  1. Step 1: Identify real-time state storage method

    Kafka Streams state stores hold live data accessible via interactive queries.
  2. Step 2: Choose best approach for live dashboard

    Using ReadOnlyKeyValueStore allows querying current counts directly without extra DB.
  3. Final Answer:

    Use a ReadOnlyKeyValueStore to store user statuses and query counts live -> Option D
  4. Quick Check:

    Interactive queries + state store = real-time dashboard [OK]
Quick Trick: Use state store with interactive queries for live data [OK]
Common Mistakes:
MISTAKES
  • Relying on external DB instead of state store
  • Polling Kafka consumer instead of querying store
  • Using local variables which are not shared state

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes