小编Dim*_*hon的帖子

Kafka with python:如何将主题发送到 postgreSQL?

我被敦促将 Kafka 与 python 一起使用。此外,我需要开发一个非常简单的生产者-消费者应用程序,该应用程序实时从设备读取指标,然后将它们发布到 Kafka 中的主题“指标”。然后,消费者必须订阅“metrics”主题并将这些数据存储到 postgreSQL 数据库中。

我尝试在这里绘制架构:

           +-----------+        Fetch metrics every 1 second          +--------------+                                           
           |Biometric  |     {heartrate, oxygen level, temprature}     |              |                                           
           |generation ------------------------------------------------  producer.py |                                           
           |device     |                                              |              |                                           
           +-----------+                                              +-------|------+                                           
                                                                              |                                                  
                                                                              |                                                  
                                                                              |                                                  
                                                                              |Publish metrics in "metrics" topic, every 1 second
                                                                              |{heartrate, oxygen level, tempature}              
                                                                              |         JSON format                              
                                                                              |                                                  
                                                                              |                                                  
                                                                      +-------|------+                                           
                                                                      |              |                                           
                                                                      |    KAFKA     |                                           
                                                                      |              |                                           
                                                                      +-------|------+                                           
                                                                              |                                                  
                                                                              |                                                  
                                                                              |                                                  
                                                                              |                                                  
                                                                              | Subscribe to "metrics" topic and fetch           
                 -                                                            | the JSON every …
Run Code Online (Sandbox Code Playgroud)

python postgresql python-3.x apache-kafka

5
推荐指数
1
解决办法
2839
查看次数

标签 统计

apache-kafka ×1

postgresql ×1

python ×1

python-3.x ×1