I don't want to write processed KStream to another topic, I directly want to write enriched KStream to database. How should I proceed?
You can implement a custom Processor
that opens a DB connection and apply it via KStream#process()
. Cf. https://docs.confluent.io/current/streams/developer-guide/dsl-api.html#applying-processors-and-transformers-processor-api-integration
Note, you will need to do sync writes into your DB to guard against data loss.
Thus, not writing back to a topic has multiple disadvantages:
Therefore, it's recommended to write the results back into a topic and use Connect API to get the data into your database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With