Açıklaması şöyle
The duality between KStream and KTable lies in the fact that you can convert between these two representations, allowing you to switch between stream-like and table-like processing as needed:KStream to KTable: You can convert a KStream into a KTable using operations like groupByKey followed by aggregation. This is useful when you want to create a table from a stream, aggregating data over a period of time.KTable to KStream: Conversely, you can convert a KTable into a KStream. This allows you to turn a table-like representation into a stream for further processing or for joining with other streams.
Şeklen şöyle
KStream to KTable
groupBy metodu ile bir KGroupedStream elde edilir. İmzası şöyle
<KR> KGroupedStream<KR,V> groupBy(KeyValueMapper<? super K,? super V,KR> keySelector)<KR> KGroupedStream<KR,V> groupBy(KeyValueMapper<? super K,? super V,KR> keySelector, Grouped<KR,V> grouped)KGroupedStream<K,V> groupByKey()KGroupedStream<K,V> groupByKey(Grouped<K,V> grouped)
KGroupedStream ise KTable'a dönüş sağlayan aggregate, count, reduce gibi sağlıyor. Örneğin count metodunun imzası şöyle
KTable<K,Long> count()
No comments:
Post a Comment