如何从Google Cloud pubsub中获取数据到Firebase实时数据库 [英] How can I take data from google cloud pubsub to firebase realtime data base

查看:171
本文介绍了如何从Google Cloud pubsub中获取数据到Firebase实时数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从google cloud pubsub获取数据.该数据是由IOT设备生成的.每当IOT设备将数据发送到云时,我都需要将数据从pubsub传输到Firebase实时数据库.我只需要最后一个数据库中已更新的值.我该怎么办.

I need to take data from google cloud pubsub.The data is generated by an IOT devices.Whenever an IOT device sends data to cloud I need that data to be transferd from pubsub to firebase real time database.I need only the last updated value in the database.How can I do it.

推荐答案

看看Cloud Functions.他们将完全满足您的需求.

Take a look at Cloud Functions. They will do exactly what you need for this.

您需要设置和理解Firebase的一些内容,因此,先阅读一下有关Firebase的基本教程也是一个不错的计划.

There's a few pieces you'll need to setup and understand about firebase, so checking out a basic tutorial on that first would be a good plan too.

我最近做了一个会议,在会议上我们在舞台上构建了一个应用程序,而Cloud Function将我们的设备遥测技术带入了Firestore(不是Firebase RTD,而是在更新的软件包中具有相同的概念):

I did a session recently where we built an application on stage, and the Cloud Function that brought our device telemetry over into Firestore (not Firebase RTD, but same concepts in an updated package):

https://github.com/GabeWeiss/GoogleIoTCoreApp/tree/master/gcf/telemetryToFirestore

这是Cloud Function本身的代码.要了解您正在查看的作品周围的概念,请查看:

That's the code for the Cloud Function itself. To understand the concepts around the pieces you're looking at, check out:

https://firebase.google.com/docs/<-入门指南for Firebase(尽管再说一次,我还是建议您直接去Firestore)

https://firebase.google.com/docs/ <-- getting started guides for Firebase (although again, I'd recommend going straight to Firestore)

https://cloud.google.com/functions/docs/tutorials/pubsub <-发布/订阅云功能教程的教程.

https://cloud.google.com/functions/docs/tutorials/pubsub <-- tutorial for Pub/Sub Cloud Function tutorials.

这篇关于如何从Google Cloud pubsub中获取数据到Firebase实时数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆