1

I have examined confluent kafka stream wordcount and anomaly detection example. In these example result is written to a topic. Instead of this How can I save the result iinto remote database via REST or anything easily and fastly. Are there any structure in confluent platform

Code example: // instead of code, send remote database

wordCounts.toStream().to("streams-wordcount-output", Produced.with(stringSerde, longSerde));

Robin Moffatt
  • 30,382
  • 3
  • 65
  • 92
validator
  • 13
  • 3

1 Answers1

1

The usual pattern here is to write the results of your stream processing to a Kafka topic, and then use Kafka Connect to stream that topic to anywhere you want to persist the data to. Kafka Connect is part of Apache Kafka, and there are numerous connectors, including kafka-connect-jdbc for writing data to (and from) databases.

If you write directly from your streams application to the database you're unnecessarily tying together your processing and your storage. If the database is offline or unreachable your stream processing has to handle that. Instead decouple the two, and Kafka Connect will handle unreachable database etc.

Robin Moffatt
  • 30,382
  • 3
  • 65
  • 92