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













