Azure Cosmos DB触发器 [英] Azure cosmos db trigger

查看:83
本文介绍了Azure Cosmos DB触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在天蓝色的管道中调用cosmos db触发器?管道只是将数据从Azrue存储复制到cosmos db集合,并且有必要调用预触发.如何为复制活动指定触发器ID?

Is it possible to invoke cosmos db trigger in azure pipeline? Pipeline is just copy data from azrue storage to cosmos db collection and it is necessary to invoke pre trigger. How to specify trigger id for copy activity?

推荐答案

按照您的说法,您可以通过将Azure函数与

From what you are saying, you might solve this by using Azure Functions with a Blob Trigger and a DocumentDB output binding.

functions.json相似:

{
    "disabled": false,
    "bindings": [
        {
            "name": "myBlob",
            "type": "blobTrigger",
            "direction": "in",
            "path": "<name-of-the-folder-where-files-get-uploaded>",
            "connection":"MyStorageAccount"
        },
        {
          "name": "documentToSave",
          "type": "documentDB",
          "databaseName": "MyDatabase",
          "collectionName": "MyCollection",
          "createIfNotExists": true,
          "connection": "MyAccount_COSMOSDB",     
          "direction": "out"
        }
    ]
}

函数主体可能类似于:

// Blob trigger binding to a CloudBlockBlob
#r "Microsoft.WindowsAzure.Storage"

using Microsoft.WindowsAzure.Storage.Blob;

public static void Run(CloudBlockBlob myBlob, out object documentToSave, TraceWriter log)
{
    // some logic to read the blob and parse it

    documentToSave = new {
        id = "some value",
        .. other properties here
      };
}

这篇关于Azure Cosmos DB触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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