Kafka Streams Stateful Operations
Explore Kafka Streams stateful operations to combine multiple data values into a single output using reduce, aggregate, and count. Learn grouping techniques, including groupByKey and groupBy, and understand how to build real-time aggregation topologies that manage and query state effectively.
We'll cover the following...
Stateful operations, also referred to as aggregations, are used to combine multiple input values into a single output value. Kafka Streams support the following stateful operators:
reduce: This combines multiple input values of typeAinto a single outputA.aggregate: This combines multiple input values of typeAinto a single outputB.count: This counts the number of events by key.
Because aggregations involve combining multiple values associated with the same key, we have to group them before applying the aggregation operator.
Grouping
Grouping may be applied both to KStream and KTable ...