4

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?

2 Answers2

5

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").

ck1
  • 5,243
  • 1
  • 21
  • 25
1

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(): enter image description here

yuranos
  • 8,799
  • 9
  • 56
  • 65