liveBook · Manning

Sensor reading

As explained in Kafka Streams in Action, Second Edition

A sensor reading is a measurement record produced by an IoT sensor, such as a temperature or proximity observation.

A sensor reading is a measurement record produced by an IoT sensor, such as a temperature or proximity observation. Sensor readings flow to Kafka topics, where Kafka Streams applications can monitor, enrich, and aggregate them. section 9.1 section 8.6.3

A reading can serve several processing roles:

  • Feed a running aggregation that tracks count, sum, average, highest value, and threshold exceedances. section 9.1
  • Start, continue, or close a data-driven aggregation when values cross a threshold; inactivity can trigger emission after ten seconds. section 10.3
  • Supply sensor identity or measurement data for joining with metadata held in a GlobalKTable, even when the original record has no key. section 8.6.3

Manufacturing temperature monitoring

A production line publishes temperature readings continuously. The stream ignores values below a configured threshold, aggregates sustained high readings, and emits the result when the temperature falls, enough readings arrive, or ten seconds pass without another high reading. section 10.3

Listing 9.1 Creating an aggregation to track IoT temperature sensor readings
KStream<String,Double> iotHeatSensorStream =
      builder.stream("heat-sensor-input",
                 Consumed.with(stringSerde, doubleSerde));
iotHeatSensorStream.groupByKey()    #1
          .aggregate(() -> new IotSensorAggregation(tempThreshold),    #2
                     aggregator,
                     Materialized.with(stringSerde, aggregationSerde))
          .toStream()
          .to("sensor-agg-output", Produced.with(
                        stringSerde, aggregationSerde));     #3

Inspect the Kafka Streams topology that consumes heat-sensor readings, groups them by key, aggregates them, and writes sensor results to an output topic. section 9.1

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Explains readings through aggregation, threshold state, windowing, and metadata joins, but stops short of sensor hardware details.
Examples
Uses manufacturing temperature and proximity observations, threshold spikes, heat-sensor topics, and sensor metadata enrichment.
What it assumes
Assumes Kafka topics and Kafka Streams processing while demonstrating keys, state stores, timestamps, and stream-global table joins.
What you can do after
Apply via Kafka Streams to aggregate readings, detect sustained temperature spikes, emit results, and attach sensor metadata.
How it connects
Connects sensor readings with IoT sensors, Kafka topics, Kafka Streams, aggregation, windowing, and GlobalKTable joins.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka Streams in Action, Second Edition. The section links point to the parts of the book it draws on.