简体   繁体   English

Azure function - 多个文件同时进入存储 blob:如何按顺序处理它们

[英]Azure function - multiple files coming in storage blob at the same time: how to make them be processed sequentially

I'm building a solution who extract data from invoice PDF with the Microsoft Form Recgnizer Api and add the information to an SQL Database.我正在构建一个解决方案,该解决方案使用 Microsoft Form Recgnizer Api 从发票 PDF 中提取数据,并将信息添加到 SQL 数据库中。

I build a parser and a code who add rows from the API response to a database when a pdf is uploaded in my storage blob with success.我构建了一个解析器和一个代码,当 pdf 成功上传到我的存储 blob 时,将 API 响应中的行添加到数据库。

I'm looking for the easiest way to handle multiple PDF coming at the same time in my database.我正在寻找最简单的方法来处理数据库中同时出现的多个 PDF。

I'm facing deadlocks issues when i make a test with multiple pdf incoming because there is process conflict in SQL server: if i upload 4 pdf, the 4 PDF are processed a the same time and are being parsed and data added to SQL at the same time, which cause conflict and potentially non logical arrangement of the database rows (i don't want to make an update group By invoice number after each process to re arrange the whole table).当我对多个 pdf 传入进行测试时,我面临死锁问题,因为 SQL 服务器中存在进程冲突:如果我上传 4 个 pdf,则同时处理 4 个 PDF 并正在解析并将数据添加到 SQL同时,这会导致数据库行的冲突和潜在的非逻辑排列(我不想在每个过程后按发票号更新组以重新排列整个表)。

Now, i'm looking at a solution who can take every element incoming in storage blob one after another, instead of all at the same time.现在,我正在寻找一种解决方案,它可以一个接一个地获取存储 blob 中的每个元素,而不是同时获取所有元素。 Something like a For loop who iterate sequentially on every blob "source" and send them in entry for my parsing function.类似于 For 循环,它在每个 blob“源”上按顺序迭代并将它们发送到入口以供我解析 function。

Or something like a queue who could work like this:或者类似队列的东西可以像这样工作:

PDF1, PDF2, PDF3 incoming in storage blob: PDF1、PDF2、PDF3 传入存储 blob:

Make PDF2 and PDF3 waiting, send PDF1 to API analyse, add data to SQL and when last row added, send PDF2 to API analyse, add data to SQL and when last row added, send PDF3 etc让 PDF2 和 PDF3 等待,发送 PDF1 到 API 分析,添加数据到 SQL 当添加最后一行时,发送 PDF2 到 API 分析,添加数据到 SQL 当添加最后一行时,发送 PDF3 等

Thanks for your suggestion:)谢谢你的建议:)

You can route Azure blob storage events to an Azure Function. https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-event-overview您可以将 Azure blob 存储事件路由到 Azure Function。https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-event-overview

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

相关问题 Azure Functions 为同一个 Blob 存储事件触发多次 - Azure Function fires multiple times for the same Blob storage event 使用 Python 在内存中提取多个压缩 JSON 文件并将它们保存到 Azure Blob 存储 - Extracting multiple zipped JSON files in-memory and saving them to Azure Blob Storage with Python 如何将文件上传到Azure Blob存储? - How to upload files to azure blob storage? 如何使用 azure Function app 将文件从桌面上传到 Azure Blob 存储 - how to Upload a files from Desktop to Azure blob storage using azure Function app Azure function 和 Azure Blob 存储 - Azure function and Azure Blob Storage 如何让多个文件同时运行? - How to make multiple files run at the same time? 为什么同时读取多个文件比顺序读取慢? - Why is reading multiple files at the same time slower than reading sequentially? Microsoft Azure 计时器功能未将文件上传到 blob 存储 - Microsoft Azure Timer Function not uploading files to blob storage 在存储帐户 python(天蓝色功能)之间移动或复制文件(blob)? - move or copy files(blob) between storage accounts python (azure function)? 如何使用 azure ZC1C425Z574E68385D1CAB1 编辑 azure blob 存储中的 *.csv 文件 - How to edit a *.csv file in the azure blob storage with an azure function?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM