score:3

Accepted answer

This is not how a KTable works.

A KTable itself, has an internal state store and stores exactly one record per key. However, a KTable is constantly updated and subject to the so-called stream-table-duality. Each update to the KTable is sent downstream as a changelog record: https://docs.confluent.io/current/streams/concepts.html#duality-of-streams-and-tables. Thus, each input record result in an output record.

Because it's stream processing, there is no "last key per value".

I have a topic that has a stream of data coming to it. What I need is to create a separate topic from this topic that only has the latest set of values given the keys.

At which point in time do you want a KTable to emit an update? There is no answer to this question because the input stream is conceptually infinite.


Related Query

More Query from same tag