Let’s Get Certified
Module 08 / 11 · Ingest and transform data

Process events according to when they happened

A sensor reports at 12:01 but its message arrives at 12:05.

Process events according to when they happened

A sensor reports at 12:01 but its message arrives at 12:05. Separate the event timestamp from arrival time. Choose the grouping window, permissible lateness and deduplication key before selecting an engine. Eventstreams can route events with low-code transformations. Use Structured Streaming for custom state and checkpoints, and KQL in Eventhouse for time-oriented exploration.

Decisions to rehearse

Tumbling event-time window
Fixed nonoverlapping event-time windows assign each event to one interval.
Sliding or hopping window
Overlapping windows allow one event to contribute to multiple time intervals.
Watermark and lateness policy
A watermark bounds retained state and defines how late records can contribute under the chosen operator.
Eventstream routing
A Fabric eventstream can filter and route incoming streams to supported destinations without custom Spark code.
Spark Structured Streaming checkpoint
A durable checkpoint stores streaming progress and recovery information for the Spark query.
KQL time bin and summarize
Eventhouse supports time-binned aggregation over ingested events through KQL.

Practise each Microsoft skill

These local references follow the Microsoft bullet order within this skills group.

  1. 2.3.1 · Choose Eventstream, Structured Streaming or Eventhouse KQL from code requirements, state and the destination.
  2. 2.3.2 · Configure a source, filter and two destinations in an eventstream; trace a single sample event through the intended branch.
  3. 2.3.3 · Give a stateful Spark streaming query its checkpoint and verify that a restart resumes the correct position.
  4. 2.3.4 · Run a KQL aggregation against ingested telemetry and compare a bounded interval with a hand-counted sample.
  5. 2.3.5 · Compute the same counts with tumbling and overlapping windows. Explain exactly which samples contribute twice.

Official skills for this topic

Work through the decision

A reading captured at 10:04 arrives after a 10:06 reading. Operations wants five-minute totals by capture time. Which batch should change, and what limits further corrections?

Check your reasoning

The late reading belongs to the 10:00–10:05 window. Its arrival can update that window while the permitted event-time lateness and processing mode allow it. Define what to do with later arrivals explicitly.

DP-700 recording · 45:12

Measure the effect of an out-of-order arrival

48:34 · Tumbling and overlapping windows. A fixed five-minute window determines which bucket owns a reading. The lab tests how that answer changes when you switch clocks.

Each pair is (event minute, arrival minute). Group the same records into five-minute capture and arrival windows. Decide how late a reading must be allowed to arrive to retain the third event. Run with Python 3 and its standard library.

from collections import Counter

readings = [(1, 1), (6, 6), (4, 8), (9, 9)]
def buckets(index):
    counts = Counter(pair[index] // 5 * 5 for pair in readings)
    return sorted(counts.items())
print("event time:", buckets(0))
print("arrival time:", buckets(1))
print("maximum delay:", max(arrival - event for event, arrival in readings))
Check the result
event time: [(0, 2), (5, 2)]
arrival time: [(0, 1), (5, 3)]
maximum delay: 4

The 12:04 event arrives at 12:08 but belongs in the earlier capture-time bucket. The observed four-minute transport delay and the two-minute gap behind the largest event time seen before its arrival answer different questions. A watermark is based on observed event-time progress.

Related lesson in Data Engineer Associate · Structured Streaming.

Knowledge check

Process events according to when they happened quiz

Answer 3 questions. Check each answer for an explanation.

Worked example · Process events according to when they happened