小编Tho*_*get的帖子

使用 utcnow() 作为管道参数的 Azure 数据工厂 v2

对于上下文,我目前有一个 Data Factory v2 管道,其中有一个ForEach Activity调用Copy Activity。该复制活动只是从FTP服务器到Blob存储容器复制数据。

这是管道 json 文件:

{
    "name": "pipeline1",
    "properties": {
        "activities": [
            {
                "name": "ForEach1",
                "type": "ForEach",
                "typeProperties": {
                    "items": {
                        "value": "@pipeline().parameters.InputParams",
                        "type": "Expression"
                    },
                    "isSequential": true,
                    "activities": [
                        {
                            "name": "Copy1",
                            "type": "Copy",
                            "policy": {
                                "timeout": "7.00:00:00",
                                "retry": 0,
                                "retryIntervalInSeconds": 30,
                                "secureOutput": false
                            },
                            "typeProperties": {
                                "source": {
                                    "type": "FileSystemSource",
                                    "recursive": true
                                },
                                "sink": {
                                    "type": "BlobSink"
                                },
                                "enableStaging": false,
                                "cloudDataMovementUnits": 0
                            },
                            "inputs": [
                                {
                                    "referenceName": …
Run Code Online (Sandbox Code Playgroud)

azure azure-data-factory azure-data-factory-2

5
推荐指数
2
解决办法
2万
查看次数

Azure Functions EventGrid 触发器

我已经实现了一个 EventGrid 触发器来响应 Blob 存储事件,其逻辑简化如下:

public static async void Run(
    JObject eventGridEvent,
    TraceWriter log,
    ExecutionContext context)
{
    string eventContent = ParseEvent(eventGridEvent);

    HttpClient client = GetProxyClient();
    HttpResponseMessage response = await client.GetAsync("blabla/" + eventContent);
    string responseContent = await response.Content.ReadAsStringAsync();
    log.Info("Here is the response :" + responseContent);
}
Run Code Online (Sandbox Code Playgroud)

外部 API 响应时间不长(1 秒或更短),我的主机配置设置为默认值(因此允许无限数量的并发调用)。

同时添加多个 blob(从 2 个 blob 开始)时,我在日志中收到了大量重复事件(脚本正在快速地一个接一个地上传 blob,中间没有等待时间)。

我觉得这可能是因为我从不承认接收到事件,而且我不知道是否应该在我的代码中执行此操作,或者 EventGrid 触发器是否会自动执行此操作。

确认事件处理的逻辑应该在 EventGrid 触发器(Http 200 响应)中实现还是自动处理?

如果不是,我应该仍然收到重复的事件吗?通常,在上传单个 blob 时,我会收到 3-4 次事件。

我问这个问题的原因是,当使用 Http 触发器并返回 400 响应时,我也会得到重复的事件,这是有道理的,因为我没有承认正确处理了事件。但是,当我返回 200 响应时,我不会收到重复的事件。

谢谢

c# azure azure-blob-storage azure-functions azure-eventgrid

3
推荐指数
1
解决办法
659
查看次数