英文:
Reading data from firebase real-time database using springboot
问题
我是云计算的新手。我尝试从存储在Firebase实时数据库中的一些传感器中读取一些数据。
- 在我的Springboot(Java)应用程序中,我该如何获取实时数据。提供一个示例或参考资料将非常有帮助。
- 是否有办法在实时数据库数据更新后立即将数据自动转储到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:
- How can I get realtime data in my Springboot (Java) application. An example or reference would be really helpful.
- 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).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论