本文介绍了在Python中使用IOT适配器和google pub / sub api将MQTT与GCP集成在一起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从App Engine标准集成Cloud Pub / Sub API



我正在开发标准Python环境中的Google应用引擎应用程序。对于代码的某些部分,我需要与Google Cloud pub / sub API集成。

正如前面提到的产品(完全披露,我从事此工作),而不是在App Engine上托管MQTT。 Cloud IoT Core可让您连接到Google提供的MQTT桥接器,以便将您的数据放入Google Cloud PubSub。您可以使用Google Cloud DataFlow将数据从PubSub移动到数据仓库进行分析,也可以使用自己的数据库作为DataFlow的输出。



用于通信的连接详细信息使用Google云物联网核心MQTT桥接器将,但您需要注意的重要连接属性是主机名(mqtt.googleapis.com)端口(8883或443)和MQTT密码/客户端ID,它们将基于您所使用的设备为您的服务提供服务。

您需要选择实际的MQTT客户端,具体取决于您试图访问MQTT桥的编程语言。如果您尝试使用Android,则可以从,最终可能会包含一些。

Integration with Cloud Pub/Sub APIs from App Engine Standard

I am working on developing a Google app engine app in standard Python environment. For some portions of the code, I need to integrate with Google Cloud pub/sub APIs.

As mentioned here, Pub/Sub can only be integrated in the App Engine flexible environment (BTW it is also only in alpha). Can someone please describe how to integrate with Pub/Sub in the App Engine Standard environment?

My use case description

I am trying to integrate MQTT with google app engine by using Agosto IOT broker. I will be using MQTT for clients (Currently mobile platforms) and on server side, I plan to use pub/sub for receiving/sending the messages and saving relevant data to the database.

解决方案

You might want to try instead to use the new Google Cloud IoT Core product (full disclosure, I worked on it) instead of hosting MQTT on App Engine. Cloud IoT Core lets you connect to a Google-provided MQTT bridge that will put your data into Google Cloud PubSub. You can use Google Cloud DataFlow to move your data from PubSub to your data warehouse for analytics or can use your own database as the output from DataFlow.

The connection details for communicating with the Google Cloud IoT Core MQTT bridge are discussed in detail in the documentation but the important connection properties you will need to be aware of are the hostname (mqtt.googleapis.com) port (8883 or 443) and the MQTT password / client ID which are going to be based on the devices you've provisioned for the service.

Your actual MQTT client will need to be chosen depending on which programming language you're trying to access the MQTT bridge. If you're trying from Android, you could start from the Java MQTT client sample and would probably end up with something like the Android Things Cloud IoT sensor hub connector from the AndroidThings team.

这篇关于在Python中使用IOT适配器和google pub / sub api将MQTT与GCP集成在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 13:21