Azure Blob 存储功能的并发问题

Concurrency problem with Azure Blob Storage function

Azure 函数正在同时处理 blob 存储中的多个文件。 这会导致在动态 CRM 中创建重复数据,因为 azure 函数正在并行执行处理多个文件。谁能帮我,我如何限制 azure 函数一次处理一个文件?

根据官方文档Azure Blob storage bindings for Azure FunctionsTrigger - concurrency and memory usage部分,如下图

The blob trigger uses a queue internally, so the maximum number of concurrent function invocations is controlled by the queues configuration in host.json. The default settings limit concurrency to 24 invocations. This limit applies separately to each function that uses a blob trigger.

所以你可以按照下面host.json模板文件的内容将queues.batchSize值设置为1来限制Azure Function with Blob Trigger每次处理一个文件.

作为参考,有两个类似的SO线程,您也可以参考。