C
C#2y ago
TJacken

✅ Blob trigger and save blob information in database

Hi all, first time to ask here. How would you approach to this problem, I have endpoint in aspnet core where I send file. When file get to controller I need to upload file on Azure blob storage and save file data in database (file name, description,...). When file get at blob container it will trigger blob azure function which need to read data from database. So flow is this: 1) - controller get file - file is sent to blob storage - save file information to database 2) - blob trigger is activated - read file information from database How to solve this from 1), file is uploaded to blob storage and database throw exception, so I have blob file which will trigger azure function but don't have record in database?
6 Replies
Mayor McCheese
Save data to the database, upload blob; have retries on the upload to blob storage, if the upload blob fails have a counter commit to the database.
TJacken
TJackenOP2y ago
@.mayormccheese Had same idea, but waited someone to answer, can you tell me what is counter commit to the database?
Mayor McCheese
So you save records; but if blob fails to upload; what then? Are the records in the db still valid; or do you have to counter commit; ie delete records Whatever you're trying to do sounds weird though, but ¯\_(ツ)_/¯
TJacken
TJackenOP2y ago
I know :D, but I succeeded in clarifying this flow for myself, so thank you for the advice 🙂
MODiX
MODiX2y ago
Use the /close command to mark a forum thread as answered
Mayor McCheese
If you're satisfied with your care

Did you find this page helpful?