K
- Type of keysV
- Type of values@InterfaceStability.Unstable
public interface KGroupedStream<K,V>
KGroupedStream
is an abstraction of a grouped record stream of key-value pairs
usually grouped on a different key than the original stream key
It is an intermediate representation of a KStream
before an
aggregation is applied to the new partitions resulting in a new KTable
.
KStream
Modifier and Type | Method and Description |
---|---|
<T> KTable<K,T> |
aggregate(Initializer<T> initializer,
Aggregator<K,V,T> aggregator,
Serde<T> aggValueSerde,
String storeName)
Aggregate values of this stream by key into a new instance of a
KTable . |
<W extends Window,T> |
aggregate(Initializer<T> initializer,
Aggregator<K,V,T> aggregator,
Windows<W> windows,
Serde<T> aggValueSerde,
String storeName)
Aggregate values of this stream by key on a window basis into a new instance of windowed
KTable . |
KTable<K,Long> |
count(String storeName)
Count number of records of this stream by key into a new instance of a
KTable . |
<W extends Window> |
count(Windows<W> windows,
String storeName)
Count number of records of this stream by key on a window basis into a new instance of windowed
KTable . |
KTable<K,V> |
reduce(Reducer<V> reducer,
String storeName)
Combine values of this stream by the grouped key into a new instance of ever-updating
KTable . |
<W extends Window> |
reduce(Reducer<V> reducer,
Windows<W> windows,
String storeName)
Combine values of this stream by key on a window basis into a new instance of windowed
KTable . |
KTable<K,V> reduce(Reducer<V> reducer, String storeName)
KTable
. The resulting KTable
will be materialized in a local state
store with the given store name. Also a changelog topic named "${applicationId}-${storeName}-changelog"
will be automatically created in Kafka for failure recovery, where "applicationID"
is specified by the user in StreamsConfig
.<W extends Window> KTable<Windowed<K>,V> reduce(Reducer<V> reducer, Windows<W> windows, String storeName)
KTable
.
The resulting KTable
will be materialized in a local state
store with the given store name. Also a changelog topic named "${applicationId}-${storeName}-changelog"
will be automatically created in Kafka for failure recovery, where "applicationID"
is specified by the user in StreamsConfig
.reducer
- the instance of Reducer
windows
- the specification of the aggregation Windows
storeName
- the name of the state store created from this operationKTable
which can be treated as a list of KTable
s
where each table contains records with unmodified keys and values
that represent the latest (rolling) aggregate for each key within that window<T> KTable<K,T> aggregate(Initializer<T> initializer, Aggregator<K,V,T> aggregator, Serde<T> aggValueSerde, String storeName)
KTable
.
The resulting KTable
will be materialized in a local state
store with the given store name. Also a changelog topic named "${applicationId}-${storeName}-changelog"
will be automatically created in Kafka for failure recovery, where "applicationID"
is specified by the user in StreamsConfig
.T
- the value type of the resulting KTable
initializer
- the instance of Initializer
aggregator
- the instance of Aggregator
aggValueSerde
- aggregate value serdes for materializing the aggregated table,
if not specified the default serdes defined in the configs will be usedstoreName
- the name of the state store created from this operationKTable
that represents the latest (rolling) aggregate for each key<W extends Window,T> KTable<Windowed<K>,T> aggregate(Initializer<T> initializer, Aggregator<K,V,T> aggregator, Windows<W> windows, Serde<T> aggValueSerde, String storeName)
KTable
.
The resulting KTable
will be materialized in a local state
store with the given store name. Also a changelog topic named "${applicationId}-${storeName}-changelog"
will be automatically created in Kafka for failure recovery, where "applicationID"
is specified by the user in StreamsConfig
.T
- the value type of the resulting KTable
initializer
- the instance of Initializer
aggregator
- the instance of Aggregator
windows
- the specification of the aggregation Windows
aggValueSerde
- aggregate value serdes for materializing the aggregated table,
if not specified the default serdes defined in the configs will be usedstoreName
- the name of the state store created from this operationKTable
which can be treated as a list of KTable
s
where each table contains records with unmodified keys and values with type T
that represent the latest (rolling) aggregate for each key within that windowKTable<K,Long> count(String storeName)
KTable
.
The resulting KTable
will be materialized in a local state
store with the given store name. Also a changelog topic named "${applicationId}-${storeName}-changelog"
will be automatically created in Kafka for failure recovery, where "applicationID"
is specified by the user in StreamsConfig
.<W extends Window> KTable<Windowed<K>,Long> count(Windows<W> windows, String storeName)
KTable
.
The resulting KTable
will be materialized in a local state
store with the given store name. Also a changelog topic named "${applicationId}-${storeName}-changelog"
will be automatically created in Kafka for failure recovery, where "applicationID"
is specified by the user in StreamsConfig
.windows
- the specification of the aggregation Windows
storeName
- the name of the state store created from this operationKTable
which can be treated as a list of KTable
s
where each table contains records with unmodified keys and values
that represent the latest (rolling) count (i.e., number of records) for each key within that window