You want to create a topology that reads from two topics, merges their streams, filters messages with key starting with 'A', and writes to a single output topic. Which code snippet correctly builds this?
Filter is applied on merged stream, then sent to one output topic.
Step 3: Exclude incorrect options
KStream merged = builder.stream("topic1", "topic2");
merged.filter((k,v) -> v.startsWith("A")).to("output"); incorrectly filters on value instead of key; C and D write separately, not merged.
Final Answer:
Explicitly merges two streams using merge(), filters keys starting with 'A', and writes to output -> Option A
Quick Check:
Merge streams then filter and output [OK]
Quick Trick:Use merge() to combine streams before filtering [OK]
Common Mistakes:
MISTAKES
Trying to stream multiple topics in one call
Writing streams separately instead of merged
Filtering before merging incorrectly
Master "Streams" in Kafka
9 interactive learning modes - each teaches the same concept differently