As there is no "to()" method for KTable so do we need to always convert it to KStream before sending any message to a topic? Or how can we store a KTable in our topic?
As there is no "to()" method for KTable so do we need to always convert it to KStream before sending any message to a topic? Or how can we store a KTable in our topic?
Yes, in order to materialize a KTable to a topic, you're required to convert it to a regular stream (instead of a changelog stream) via table.toStream().to("myTopic").
Note that KTable had a to method some time ago.
In general, if you check older versions of KTable, like 1.0, you'll see that the API was simplified significantly and more than a dozen methods were deprecated, many of them deleted as of today, including to():
