是否有相当于 Firebase 客户端的 Azure 数据库能够侦听数据库更改?

Is there an Azure database equivalent to Firebase clients being able to listen for database changes?

Firebase 的实时数据库 SDK 内置回调方法,允许客户端监听数据库变化。 (例如,根据 https://firebase.google.com/docs/database/android/start/

Azure 在 SQL 数据库或 DocumentDB 产品中是否具有类似的功能?如果不是,为什么不呢?使用 Azure 实现此功能的最佳方式是什么?

谢谢。

编辑 上下文:我正在使用 Xamarin 构建跨平台移动应用程序。

Azure 的 SQL 数据库服务现在有扩展事件(目前处于预览阶段)。更多信息 here.

DocumentDB 没有您可以订阅的事件。在修改数据库内容时,您需要建立自己的机制来采取行动。

编辑:Cosmos DB(以前称为 DocumentDB,最初发布此答案时)提供了一个您可以订阅的更改提要。

至于"best way to achieve this functionality" - 没有最好的办法。根据您的应用程序、选择的框架等,您决定构建什么。

Microsoft 刚刚 announced DocDb 中的一项名为 Change Feed 的新功能,这听起来正是您正在寻找的。它默认启用并包含在 DocDb 的成本中。

来自他们的公告:"With Change Feed support, DocumentDB provides a sorted list of documents within a DocumentDB collection in the order in which they were modified. This feed can be used to listen for modifications to data within the collection and perform actions..."

有关如何使用更改源的文档可在此处找到:https://docs.microsoft.com/en-us/azure/documentdb/documentdb-change-feed