Bird
0
0

Identify the error in this Kafka Streams state store initialization code: StreamsBuilder builder = new StreamsBuilder(); builder.addStateStore(Stores.inMemoryKeyValueStore("store1"));

medium📝 Debug Q6 of 15
Kafka - Advanced Stream Processing
Identify the error in this Kafka Streams state store initialization code: StreamsBuilder builder = new StreamsBuilder(); builder.addStateStore(Stores.inMemoryKeyValueStore("store1"));
AaddStateStore requires a StoreBuilder, not a StateStore instance
BinMemoryKeyValueStore is deprecated and cannot be used
CThe store name must be unique across all topics
DStreamsBuilder does not support state stores
Step-by-Step Solution
Solution:
  1. Step 1: Check method parameter requirements

    addStateStore expects a StoreBuilder object, not a StateStore instance.
  2. Step 2: Verify correct usage

    Stores.inMemoryKeyValueStore returns a StateStore, so it must be wrapped in a StoreBuilder.
  3. Final Answer:

    addStateStore requires a StoreBuilder, not a StateStore instance -> Option A
  4. Quick Check:

    addStateStore needs StoreBuilder [OK]
Quick Trick: Use StoreBuilder with addStateStore, not raw store [OK]
Common Mistakes:
  • Passing StateStore instead of StoreBuilder
  • Assuming inMemoryKeyValueStore is deprecated
  • Thinking store names must match topics

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes