简体   繁体   English

Azure 事件触发器多次触发同一个文件

[英]Azure Event Trigger fires multiple times same file

I have a blob storage container where I have configured a Event-grid trigger (Blob Created).我有一个 blob 存储容器,我在其中配置了一个事件网格触发器(已创建 Blob)。 I am loading this blob storage files through Data factory and many times it will happen that many files may come up in this blob in one shot.我正在通过数据工厂加载这个 blob 存储文件,很多时候很多文件可能会一次性出现在这个 blob 中。 May be we can take an example of 20 files.也许我们可以以 20 个文件为例。

The good news is my event-grid trigger is firing and the function app is called.好消息是我的事件网格触发器正在触发并调用了 function 应用程序。 However, I can see that sometimes for the same file the event-grid trigger is fired more than once.但是,我可以看到有时对于同一个文件,事件网格触发器会被触发不止一次。

Out of these 20 files there are few files which are very large say 300 MB but others are pretty small like in 3KBs.在这 20 个文件中,有几个文件非常大,比如 300 MB,但其他文件非常小,比如 3KB。 So my doubt is while this 300 MB is fired and it is still processing, parallelly it picks the same 300 MB file again (since it feels that it is still not read) and is saved in db multiple times which is not want I want.所以我的疑问是,虽然这 300 MB 被解雇并且它仍在处理,但同时它再次选择相同的 300 MB 文件(因为感觉它仍然没有被读取)并多次保存在 db 中,这不是我想要的。

Is Azure Event-grid would be the right approach for this scenario? Azure 事件网格是这种情况下的正确方法吗?

Once event grid trigger Azure Function for an event.一旦事件网格触发 Azure Function 一个事件。 It is excepting some reply from azure function in next 2 mins.在接下来的 2 分钟内,azure function 的一些回复除外。 If there is no response, Else Event grid will retry again.如果没有响应,Else Event 网格将重试。

Default value of retry for event grid is 30. Change it to 1.事件网格的重试默认值为 30。将其更改为 1。

Now even for large files that process for more than 2 mins, second duplicate trigger will not happen.现在即使对于处理时间超过 2 分钟的大文件,也不会发生第二次重复触发。

I can see, you opened a new thread for handling your problem which also is based on the Push-Push pattern for the event processing.我可以看到,您打开了一个新线程来处理您的问题,该线程也基于事件处理的推推模式。

I do recommend to use the Push-Pull pattern, where the AEG will deliver an event to the queue storage and then based on the needs can be processed by Azure Queue Trigger function in the concurrent manner, see more details here .我推荐使用Push-Pull模式,其中 AEG 会将事件传递到队列存储,然后可以根据需要由 Azure 队列触发器函数以并发方式处理,请参阅此处的更多详细信息。

Notes:笔记:

  1. The default timeout of the AF for Consumption plan is 5 minutes with a maximum 10 minutes .消费计划AF 的默认超时时间为5 分钟,最长为10 分钟 If this time is not enough for processing a large blob, you should use a Premium Plan where the default timeout is 30 minutes with a maximum time 60 minutes.如果此时间不足以处理大型 blob,则应使用高级计划,其中默认超时为 30 分钟,最长为 60 分钟。

  2. In the case when you want to keep your business logic in the ADF pipeline, have a look at here how easy can be invoked the pipeline from the azure function.如果您希望将业务逻辑保留在 ADF 管道中,请在此处查看从 azure 函数调用管道是多么容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure Functions 为同一个 Blob 存储事件触发多次 - Azure Function fires multiple times for the same Blob storage event 多次执行Azure功能队列触发器 - Azure Function Queue Trigger Executing Multiple Times Azure 计时器函数在触发器上多次运行 - Azure Timer Function is running multiple times on trigger 使用Azure函数多次调用同一条消息的服务总线队列触发器 - Service bus queue trigger with Azure function calling multiple times for same message 有什么机制可以防止同一blob多次触发横向扩展Azure函数触发器 - What is the mechanism that prevents a scaled out Azure Function trigger by the same blob multiple times Azure 函数服务总线触发器触发的次数比队列中的消息次数多 - Azure Function Service Bus trigger fires more times than messages in the queue HTTP 按需触发 azure 函数多次调用自身 - HTTP Trigger on demand azure function calling itself multiple times 同一服务总线队列消息多次运行的Azure函数 - Azure function running multiple times for the same service bus queue message 如果Azure功能超时,触发消息是否会放回Azure队列中? - If Azure function times out, is the trigger message put back on the Azure queue? 如何使用 sendBatch 发送最大数据或从 azure function 多次发送到事件中心? - How Can I send maximum of data with sendBatch or sending multiple times from azure function to the event hub?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM