Bird
0
0

You want to combine a punctuator scheduled with WALL_CLOCK_TIME and a state store cleanup every 30 seconds. How should you implement this?

hard📝 Application Q9 of 15
Kafka - Advanced Stream Processing
You want to combine a punctuator scheduled with WALL_CLOCK_TIME and a state store cleanup every 30 seconds. How should you implement this?
ASchedule a punctuator with Duration.ofMinutes(1) and manually track 30-second intervals.
BSchedule two punctuators: one with STREAM_TIME and one with WALL_CLOCK_TIME, both every 30 seconds.
CUse only STREAM_TIME punctuator and rely on record timestamps for cleanup.
DSchedule a punctuator with Duration.ofSeconds(30), PunctuationType.WALL_CLOCK_TIME, and inside it call stateStore.deleteExpired().
Step-by-Step Solution
Solution:
  1. Step 1: Understand the need for wall clock based cleanup

    Cleanup every 30 seconds regardless of record arrival requires WALL_CLOCK_TIME scheduling.
  2. Step 2: Implement punctuator calling state store cleanup

    Schedule a punctuator every 30 seconds with WALL_CLOCK_TIME and call stateStore.deleteExpired() inside the callback.
  3. Final Answer:

    Schedule a punctuator with Duration.ofSeconds(30), PunctuationType.WALL_CLOCK_TIME, and inside it call stateStore.deleteExpired(). -> Option D
  4. Quick Check:

    Periodic cleanup = WALL_CLOCK_TIME punctuator [OK]
Quick Trick: Use WALL_CLOCK_TIME for periodic cleanup tasks [OK]
Common Mistakes:
  • Using STREAM_TIME for time-based cleanup
  • Scheduling multiple punctuators unnecessarily
  • Incorrect interval or manual tracking

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes