Bird
0
0

Given the following code snippet in a Kafka Streams processor:

medium📝 Predict Output Q13 of 15
Kafka - Advanced Stream Processing
Given the following code snippet in a Kafka Streams processor:
context.schedule(Duration.ofMinutes(1), PunctuationType.STREAM_TIME, timestamp -> {
    System.out.println("Punctuator triggered at " + timestamp);
});
What will be printed when the punctuator triggers?
APunctuator triggered at current system time in milliseconds
BPunctuator triggered at the stream time (event time) in milliseconds
CPunctuator triggered at a fixed string 'timestamp'
DNo output because punctuator is not scheduled correctly
Step-by-Step Solution
Solution:
  1. Step 1: Identify the PunctuationType used

    The code uses PunctuationType.STREAM_TIME, which triggers based on event time in the stream.
  2. Step 2: Understand the timestamp parameter

    The timestamp passed is the stream time in milliseconds, not system time.
  3. Final Answer:

    Punctuator triggered at the stream time (event time) in milliseconds -> Option B
  4. Quick Check:

    PunctuationType.STREAM_TIME = stream event time [OK]
Quick Trick: STREAM_TIME triggers use event time, not system clock [OK]
Common Mistakes:
MISTAKES
  • Confusing STREAM_TIME with WALL_CLOCK_TIME
  • Expecting system time instead of stream time
  • Assuming no output due to scheduling

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes