Himanshu Chandra
Himanshu Chandra

Reputation: 41

How to write KTable in a Kafka topic? Like we use "to()" in KStreams how to do that for KTable?

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?

Upvotes: 4

Views: 3234

Answers (2)

yuranos
yuranos

Reputation: 9715

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

Upvotes: 1

ck1
ck1

Reputation: 5443

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

Upvotes: 5

Related Questions