[英]Is it possible to invoke cosmos db trigger from stream analytics?
I have some devices sending data to Azure iot hub.我有一些设备将数据发送到 Azure 物联网集线器。 I am using stream analytics service to process the data and insert it in cosmos db documentdb.
我正在使用 stream 分析服务来处理数据并将其插入 cosmos db documentdb。 I thought about use cosmosdb trigger to update some docs when certain items are created, but I found that triggers are invoke via API or SDK.
我想过在创建某些项目时使用 cosmosdb 触发器来更新一些文档,但我发现触发器是通过 API 或 SDK 调用的。 Is it possible to invoke cosmos db trigger from stream analytics?
是否可以从 stream 分析中调用 cosmos db 触发器? another way to resolve the problem?
解决问题的另一种方法?
There is no trigger in ASA for CosmosDb. ASA 中没有针对 CosmosDb 的触发器。 But how about using Azure Function Trigger for CosmosDB ?
但是如何为 CosmosDB 使用 Azure Function 触发器呢? This concept is using CosmosDb Change feed, and it is the easiest way to pick up the changes in your CosmosDb.
此概念使用 CosmosDb 更改源,它是获取 CosmosDb 中更改的最简单方法。 Below is one example from the documentation attached in the link above.
以下是上述链接中所附文档的一个示例。
#r "Microsoft.Azure.DocumentDB.Core"
using System;
using Microsoft.Azure.Documents;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
public static void Run(IReadOnlyList<Document> documents, ILogger log)
{
log.LogInformation("Documents modified " + documents.Count);
log.LogInformation("First document Id " + documents[0].Id);
}
The alternative is to check on CosmosDB change feed manually and implement a solution that occasionaly takes the changes and does whatever you need.另一种方法是手动检查 CosmosDB 更改源并实施一个解决方案,该解决方案偶尔会进行更改并执行您需要的任何操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.