liveBook · Manning

Stateless system

As explained in Apache Kafka in Action

A stateless processor computes each output from the current input record without retaining processing state between records.

A stateless processor computes each output from the current record without retaining processing state between records. This makes it suitable for straightforward stream transformations such as filtering, renaming, formatting, masking, and unit conversion. section 12.2.1

Common stateless stream operations include:

  • filter() evaluates a predicate for each message and keeps only matching records. section 12.2.1
  • mapValues() changes a value while preserving its key, making it preferable when repartitioning is unnecessary. section 12.2.1
  • map() can replace both key and value, such as deriving a key from an identifier in an unkeyed record. section 12.2.1

Convert prices while preserving keys

A stream of price changes can retain only prices above $100 with filter(), then convert dollars to cents with mapValues(). The resulting records keep their original keys while carrying transformed values. section 12.2.1

mapValues((key, value) -> value.price * 100)

Inspect a compact value-only transformation that illustrates stateless processing. section 12.2.1

How Apache Kafka in Action covers it

How deep it goes
Explains filtering and key/value transformations with examples, but does not develop processor internals.
Examples
Uses price thresholds, dollar-to-cent conversion, and deriving an Apple key from an unkeyed price record.
What you can do after
Apply it via Kafka Streams to filter records and transform keys or values without retaining inter-record state.
How it connects
Connects stateless processing to Kafka Streams, Flink, filtering, mapping, keys, values, and repartitioning.

Also explained in

Compare how 14 books explain stateless system →

Related concepts

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