[英]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:笔记:
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 分钟。
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.