简体   繁体   English

从 KSQL 表中读取数据

[英]Read data from KSQL tables

maybe this is a beginner question but what is the recommended way to read data produced in KSQL?也许这是一个初学者问题,但是读取 KSQL 中生成的数据的推荐方法是什么?

Let's assume I do some stream processing and write the data to a KSQL table.假设我进行了一些流处理并将数据写入 KSQL 表。 Now I want to access this data via a Spring application (eg fan-out some live data via a websocket).现在我想通过 Spring 应用程序访问这些数据(例如,通过 websocket 扇出一些实时数据)。 My first guess here was to use Spring Kafka and just subscribe to the underlying topic.我的第一个猜测是使用 Spring Kafka 并订阅基础主题。 Or should I use Kafka Streams?还是我应该使用 Kafka Streams?

Another use-case could be to do stream processing and write the results to a Redis store (eg for a webservice which always returns current values).另一个用例可能是进行流处理并将结果写入 Redis 存储(例如,对于始终返回当前值的 Web 服务)。 What would be the approach here?这里的方法是什么?

Thanks!谢谢!

The results if KSQL queries are stored in Kafka topics.如果 KSQL 查询存储在 Kafka 主题中的结果。 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.如果查询结果是一个Table那么生成的 Kafka 主题是一个变更日志主题,这意味着您可以将其读入第三方系统(例如 Cassandra 或 Redis)中的表中。 This table will always have the latest result and you can query it from web services.此表将始终具有最新结果,您可以从 Web 服务中查询它。 Check out our Clickstream demo where we push the results into Elastic for visualization.查看我们的 Clickstream 演示,我们将结果推送到 Elastic 以进行可视化。 The visualized values are the latest values for in the corresponding tables.可视化值是对应表中的最新值。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM