Bird
0
0

Identify the error in this Kafka Streams punctuator scheduling code:

medium📝 Debug Q14 of 15
Kafka - Advanced Stream Processing
Identify the error in this Kafka Streams punctuator scheduling code:
context.schedule(5000, PunctuationType.WALL_CLOCK_TIME, timestamp -> {
    System.out.println("Triggered");
});
Acontext.schedule cannot be called inside a processor
BPunctuationType should be STREAM_TIME, not WALL_CLOCK_TIME
CCallback function must return a value
DDuration object is missing; integer milliseconds used instead
Step-by-Step Solution
Solution:
  1. Step 1: Check the schedule method parameters

    The schedule method expects a Duration object, not an integer.
  2. Step 2: Identify the incorrect argument type

    Passing 5000 as int instead of Duration.ofMillis(5000) causes a syntax error.
  3. Final Answer:

    Duration object is missing; integer milliseconds used instead -> Option D
  4. Quick Check:

    Use Duration, not int, for schedule interval [OK]
Quick Trick: Always use Duration.ofMillis or similar, not raw integers [OK]
Common Mistakes:
MISTAKES
  • Passing raw integers instead of Duration
  • Confusing PunctuationType values
  • Thinking callback must return a value

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes