Bird
0
0

Which of the following is the correct way to get a state store named myStore of type ReadOnlyKeyValueStore in Kafka Streams?

easy📝 Syntax Q12 of 15
Kafka - Advanced Stream Processing

Which of the following is the correct way to get a state store named myStore of type ReadOnlyKeyValueStore in Kafka Streams?

Astore = streams.store("myStore", ReadOnlyKeyValueStore.class);
Bstore = streams.getStore("myStore", ReadOnlyKeyValueStore);
Cstore = streams.getStore("myStore", ReadOnlyKeyValueStore.class);
Dstore = streams.store("myStore", ReadOnlyKeyValueStore);
Step-by-Step Solution
Solution:
  1. Step 1: Recall Kafka Streams store retrieval syntax

    The correct method is streams.store(storeName, storeType.class) in Java.
  2. Step 2: Match the correct syntax

    store = streams.store("myStore", ReadOnlyKeyValueStore.class); uses streams.store with class type, which is correct method name and syntax.
  3. Final Answer:

    store = streams.store("myStore", ReadOnlyKeyValueStore.class); -> Option A
  4. Quick Check:

    Use streams.store with class type [OK]
Quick Trick: Use streams.store("name", StoreClass.class) syntax [OK]
Common Mistakes:
  • Using streams.getStore instead of streams.store
  • Omitting .class for type
  • Passing type without .class

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes