Bird
0
0

What will happen if you try to query a state store that does not exist using streams.store("unknownStore", QueryableStoreTypes.keyValueStore())?

medium📝 Predict Output Q5 of 15
Kafka - Advanced Stream Processing

What will happen if you try to query a state store that does not exist using streams.store("unknownStore", QueryableStoreTypes.keyValueStore())?

AReturns null
BThrows InvalidStateStoreException
CCreates a new empty store
DReturns an empty Optional
Step-by-Step Solution
Solution:
  1. Step 1: Recall behavior for missing stores

    Querying a non-existent store throws InvalidStateStoreException in Kafka Streams.
  2. Step 2: Check options for exception

    Only Throws InvalidStateStoreException mentions this exception, matching expected behavior.
  3. Final Answer:

    Throws InvalidStateStoreException -> Option B
  4. Quick Check:

    Missing store query = InvalidStateStoreException [OK]
Quick Trick: Missing store queries throw InvalidStateStoreException [OK]
Common Mistakes:
  • Expecting null or empty result
  • Thinking store auto-creates
  • Confusing with Optional return types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes