I have a need to generate a next number for each file type my Logic Apps is generating. My Logic App is doing some translations between an WMS and a customer's ERP. The issue is the customer is requiring us to generate and maintain a sequence number to be placed in the files. The full list of requirements are:
Generate a unique sequence number. No two calls, for the same file
type, should get the same result.
Number sequence is maintained
separately by file type. There are 3 files types, so each would
have their own sequence.
Should be able to handle spurts of 10 calls
a second for a few seconds at a time, which can be the same file
Data should be stored in Azure.
I'm at the point I know I'll need to write an Azure Function to do this. It will accept one parameter, "fileType", to determine which sequence number to return. I also know I'll need to store the current number "somewhere" and that the Azure Functions itself or the database/file (thru locking) needs to be pessimistic in nature. I don't know from a cost perspective what azure storage option would work best for this scenario, as well as to make sure of the lock/release to use with that technology decision. To me, it feels like using a database to store three numbers seems like overkill.
In case others are interested, we decided to use Azure Blob Storage using Containers with a HOT setting. It seems to work well in testing. We haven't gone live yet.
The .NET code uses the StorageInfo, CloudBlobClient, CloudBlobContainer and CloudBlockBlob classes. Also had to adapt a routine, LockingEntity, to "lock or wait for release" to get a reference to the CloudBlockBlob.