从Firebase实时数据库中使用Spring Boot读取数据

huangapple go评论71阅读模式
英文:

Reading data from firebase real-time database using springboot

问题

我是云计算的新手。我尝试从存储在Firebase实时数据库中的一些传感器中读取一些数据。

以下是实时数据库中的树结构:
从Firebase实时数据库中使用Spring Boot读取数据

  1. 在我的Springboot(Java)应用程序中,我该如何获取实时数据。提供一个示例或参考资料将非常有帮助。
  2. 是否有办法在实时数据库数据更新后立即将数据自动转储到Cloud Firestore文档中。
英文:

I am a newbie to cloud. I was trying to read some data from a couple of sensors stored in firebase's realtime database.

Here is the tree from realtime database:
从Firebase实时数据库中使用Spring Boot读取数据

  1. How can I get realtime data in my Springboot (Java) application. An example or reference would be really helpful.
  2. Is there a way I can auto dump my realtime database data to cloud firestore documents as soon as it is updated.

答案1

得分: 1

Firebase拥有一组适用于许多服务器端平台(包括Java)的Admin SDK。您需要在Springboot应用程序中包含该SDK,然后按照此处所示的方式使用API从Firebase获取数据。

如果您希望根据实时数据库中的数据自动创建/更新Firestore文档,请查看Cloud Functions。它们可以在实时数据库发生写入操作时被触发,然后更新相关文档。

英文:

Firebase has a set of Admin SDKs that are available for many server-side platforms, including Java. You'll want to include the SDK in your Springboot app, and then use the API as shown here to get the data from Firebase.

If you want to automatically create/update Firestore documents based on the data in the Realtime Database, have a look at Cloud Functions. They can be triggered when a write happens to the Realtime Database, and then update the relevant document(s).

huangapple
  • 本文由 发表于 2020年10月9日 04:08:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/64269917.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定