Stream Processing · Study deck

Stream Processing Fundamentals

Imagine a temperature event from a cold-chain sensor arriving while the shipment is still moving.

Data Dora is your guide for this deck.

stream-processingevent-streamsevent-time
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: The record should explain why the stream is needed, what the output means, how events are grouped, what happens when events are late or duplicated, and which assumption reopens the decision.
  • Explain: The expected result should say which events changed state, which were rejected, whether an output was revised, and which checkpoint or replay marker proves the restart did not duplicate the output.
  • Explain: The freezer alert benefits from current evidence, whereas a monthly summary can wait; the delayed reading and live dashboard examples then show why timing and presentation still need durable rules.
iotclass.org

Major section

Streams Are Data In Motion

Stream processing handles events while new events are still arriving.

  • In IoT, that matters when a reading should change a live status, alert, control review, anomaly review, or downstream record before a complete historical dataset exists.
  • The fundamentals are not tied to a single tool.
  • When connectivity returns, five older readings may arrive after newer readings.

Why it matters

A stream that answers "was the package above 8 C for 15 minutes?" should use event time, not arrival time, because the question is about when the package was warm.

iotclass.org

Major section

Streams Are Data In Motion (continued)

Worked example: a freezer sensor sends one temperature reading per minute, but the device buffers data during a cellular outage.

  • The record also needs the allowed-late rule so reviewers know whether a delayed reading can revise the result.
  • The same stream can produce more than one output.
  • A live dashboard may show the latest received value, while a compliance window uses event-time readings and correction markers.
iotclass.org

Major section

Streams Are Data In Motion (continued)

The freezer alert benefits from current evidence, whereas a monthly summary can wait; the delayed reading and live dashboard examples then show why timing and presentation still need durable rules.

  • A live freezer alert usually belongs on the stream path because its action value falls if it waits for a daily report.
  • A monthly energy summary can remain a batch result when no consumer acts on partial totals.
  • That contrast makes the consumer's useful delay—not event volume—the first design test.
  • A dashboard may show the latest received value quickly, but the durable stream record must still identify later corrections.
iotclass.org

Major section

Build The Stream Review Record

Consumer action, maximum useful delay, and whether partial results have value.

  • A practical stream-processing review should produce a small record that another engineer can test against representative events.
  • Those two steps stop a convenient transport or processor from defining the analytical question.
  • Streaming everything even when no decision changes before a scheduled run.

Why it matters

If the rule allows updates, the affected window is corrected and the output contract tells consumers that the status changed.

iotclass.org

Major section

Build The Stream Review Record (continued)

The resulting sequence links the original action need to evidence that can survive replay and review.

  • The record should explain why the stream is needed, what the output means, how events are grouped, what happens when events are late or duplicated, and which assumption reopens the decision.
  • The consumer starts acting on current events or needs corrections while events arrive.
  • Event-time field, receive-time evidence, processing-time use, and missing-time behavior.
iotclass.org

Major section

Build The Stream Review Record (continued)

Each step narrows the same claim: why events must be processed now, what those events mean, how the question is bounded, and which state and correction evidence supports the output.

  • Device timestamp meaning, clock behavior, ingestion rule, or schema changes.
  • Choosing a window that changes the business meaning of the result.
  • Consumer asks a different question or source activity pattern changes.
  • The review does not start by asking which product should process the stream.
iotclass.org

Major section

Build The Stream Review Record (continued)

One reading arrives after newer readings from the same motor, but its event-time timestamp is trustworthy.

  • It starts by checking the event-time rule, window type, allowed lateness, duplicate policy, state key, and consumer tolerance for correction.
  • If the rule does not allow updates, the late reading is still recorded according to policy so the team can review whether the lateness assumption is still valid.
  • If the rule allows updates, the affected window is corrected and the output contract tells consumers that the status changed.
iotclass.org

Major section

Time Progress, State, And Recovery

Watermarks and checkpoints support that process, but they do not replace the stream contract.

  • A watermark is a processor's estimate that event time has advanced far enough to close or publish a result.
  • A checkpoint is recovery evidence for maintained state.
  • Also record what the consumer sees after recovery.

Key terms

If a provisional result
If a provisional result is displayed as final or a correction has no visible identity, the processor may be operational while the decision remains ambiguous.
iotclass.org

Major section

Time Progress, State, And Recovery (continued)

Neither proves that the chosen window, timestamp, or late-event rule is semantically correct for the consumer.

  • Worked example: a motor stream keeps a five-minute rolling count of over-vibration events by asset id.
  • The processor state includes the asset key, the active window, the current count, and whether the emitted status is provisional or final.
  • The review is complete only when each failure produces an expected state transition and an explainable output.
iotclass.org

Major section

Time Progress, State, And Recovery (continued)

If a late event changes the count, the output should identify the revised window and the event that caused the correction.

  • A checkpoint can restore that count after restart, but the restored bytes are only meaningful if the same event-time rule, duplicate policy, and output contract are still in force.
  • The expected result should say which events changed state, which were rejected, whether an output was revised, and which checkpoint or replay marker proves the restart did not duplicate the output.
  • Internal ResponsibilitiesValidation boundary Malformed, missing, impossible, or unknown-version events should be rejected, quarantined, or normalized before they change stream state.
iotclass.org

Major section

Time Progress, State, And Recovery (continued)

If the status is recalculated from the same events, the output should keep the same identity and show a recovery note, not create a second alert.

  • Watermark policyThe policy defines when a result can be emitted and what happens to events that arrive after that point.
  • Include an offline-buffered reading, a duplicate retry, and a restart so the review can distinguish timestamp error, identity error, state recovery, and output ambiguity.
  • If a provisional result is displayed as final or a correction has no visible identity, the processor may be operational while the decision remains ambiguous.
iotclass.org

Deck summary

Key takeaways

Stream processing handles events while new events are still arriving.

  • Worked example: a freezer sensor sends one temperature reading per minute, but the device buffers data during a cellular outage.
  • The freezer alert benefits from current evidence, whereas a monthly summary can wait; the delayed reading and live dashboard examples then show why timing and presentation still need durable rules.
  • Consumer action, maximum useful delay, and whether partial results have value.
  • The resulting sequence links the original action need to evidence that can survive replay and review.
iotclass.org

Retrieval practice

Recall check 1 of 3

Data Dora says: answer from memory, then check your reasoning.

Q1A cold-chain package sends temperature readings every minute, but cellular coverage is intermittent. Which timestamp should usually control whether a reading belongs in a temperature-excursion window?

AProcessing time, because the platform clock avoids depending on a sensor clock that may drift during disconnection.
BEvent time, because the excursion question is about when the package temperature was observed.
CThe dashboard refresh time, because the user sees the dashboard after the reading arrives.
DNo timestamp, because windows can be computed without time rules.
Show answer

Answer: B Event time ties the result to the real-world observation, while receive time mainly describes platform delay.

iotclass.org

Retrieval practice

Recall check 2 of 3

Data Dora says: answer from memory, then check your reasoning.

Q2A team says an IoT analytics result must be streamed. Which evidence best proves that streaming is justified?

AThe source sends many events, so every result from that source must be streamed immediately.
BA broker is present, so transport alone proves the stream result is correct and recoverable.
CThe dashboard looks live, so event-time, state, and correction rules can stay undocumented.
DThe consumer loses value if batch waits, and the stream record defines timing, state, output, and retest rules.
Show answer

Answer: D Streaming is justified by the decision need and by evidence that the stream output is well defined.

iotclass.org

Retrieval practice

Recall check 3 of 3

Data Dora says: answer from memory, then check your reasoning.

Q3What does a checkpoint prove in a stream-processing review?

AIt proves a closed window is complete because the saved state includes the processor's watermark position.
BIt proves the recovered window is correct because its state matches the bytes saved before the restart.
CIt supports state recovery, while correctness still depends on time, window, lateness, and output rules.
DIt means dashboard output is final even when consumers accept corrections.
Show answer

Answer: C Checkpointing helps recovery; it does not by itself prove the stream result means the right thing.

iotclass.org

Print reference

Answers

Answer key.

  1. B · Event time ties the result to the real-world observation, while receive time mainly describes platform delay.
  2. D · Streaming is justified by the decision need and by evidence that the stream output is well defined.
  3. C · Checkpointing helps recovery; it does not by itself prove the stream result means the right thing.
iotclass.org