7

maybe this is a beginner question but what is the recommended way to read data produced in KSQL?

Let's assume I do some stream processing and write the data to a KSQL table. Now I want to access this data via a Spring application (e.g. fan-out some live data via a websocket). My first guess here was to use Spring Kafka and just subscribe to the underlying topic. Or should I use Kafka Streams?

Another use-case could be to do stream processing and write the results to a Redis store (e.g. for a webservice which always returns current values). What would be the approach here?

Thanks!

Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137
DerM
  • 1,497
  • 1
  • 14
  • 27

1 Answers1

6

The results if KSQL queries are stored in Kafka topics. So you can access the results from third party applications by reading from the result topic. If the query result is a Table the resulted Kafka topic is a changelog topic meaning that you can read it into a table in third party system such as Cassandra or Redis. This table will always have the latest result and you can query it from web services. Check out our Clickstream demo where we push the results into Elastic for visualization. The visualized values are the latest values for in the corresponding tables.

https://github.com/confluentinc/ksql/tree/master/ksql-clickstream-demo#clickstream-analysis

Hojjat
  • 684
  • 4
  • 4
  • Thanks a lot for your answer. Can you clarify the term "changelog topic"? I had a look at the demo before but I get it now. It's using a kafka-connect setup and for each `Table` it creates an elasticsearch sink. – DerM Dec 28 '17 at 16:36