Bird
Raised Fist0

Which of the following is the correct syntax to create a KStream from a topic named "orders" using Kafka Streams API?

easy📝 Syntax Q3 of Q15
Kafka - Streams
Which of the following is the correct syntax to create a KStream from a topic named "orders" using Kafka Streams API?
Abuilder.createStream("orders")
Bbuilder.table("orders")
Cbuilder.stream("orders")
Dbuilder.getStream("orders")
Step-by-Step Solution
Solution:
  1. Step 1: Recall Kafka Streams API method for KStream

    The method to create a KStream is stream() on the builder object.
  2. Step 2: Verify method name and parameter

    The correct syntax is builder.stream("orders") to read from the topic "orders".
  3. Final Answer:

    builder.stream("orders") -> Option C
  4. Quick Check:

    KStream creation syntax = C [OK]
Quick Trick: Use builder.stream(topic) for KStream creation [OK]
Common Mistakes:
MISTAKES
  • Using builder.table() for KStream
  • Using non-existent methods like createStream
  • Confusing method names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes