Last month I had some time to play around and I did small project which implemented Azure Storage Queues in Business Central.
What are Azure Storage Queues?
They are service in Azure which allows to store some message in queue over HTTP and then poll these messages in some message receiver.
Why are they useful?
They are useful in some integration scenarios where you have large amounts of incoming data and you cannot process them in real time.
Take for example shop floor in manufacturing. There might be some machines reporting output every few seconds and do it for hours. When you post them directly
to business central then you cannot guarantee that all the data is received in Business Central because there might not be enough processing power, outages etc.
You can then use queues to store order no and quantity in the message queue and then process these queues in Business Central and post them one by one.
All the code is visible here:
Basic working example:
codeunit 50101 "Manage Queues"
procedure ProcessMessagesFromQueue(Queue: Text)
if Process(Queue) then begin
local procedure Process(Queue: Text): Boolean
AzureStorageQueueSdk: Codeunit AzureStorageQueuesSdk;
ImportantTestTable: Record ImportantTestTable;
MessageBody := AzureStorageQueueSdk.GetNextMessageFromQueue(Queue);
MessageId := AzureStorageQueueSdk.GetMessageIdFromXmlText(MessageBody);
MessageText := AzureStorageQueueSdk.GetMessageTextFromXmlText(MessageBody);
MessagePopreceipt := AzureStorageQueueSdk.GetMessagePopReceiptFromXmlText(MessageBody);
if (MessageId <> '') AND (MessageText <> '') then begin
ImportantTestTable."Entry No." := ImportantTestTable.GetNextEntryNo();
ImportantTestTable.Message := MessageText;
if ImportantTestTable.Insert() then begin
//important here to check if delete is succesful and then commit. Otherwise we end in loop where messages are reappearing
if AzureStorageQueueSdk.DeleteMessageFromQueue(Queue, MessageId, MessagePopreceipt) then
procedure GenerateMessagesToQueue(Queue: Text; NumberOfMessages: Integer)
AzureStorageSdk: Codeunit AzureStorageQueuesSdk;
for Counter := 0 to NumberOfMessages do begin
AzureStorageSdk.PostMessageToQueue(Queue, 'This is important business data that needs queue: ' + format(Counter))
This example is just proof of concept and it implements recursive function that polls the message queue in Azure and processes all the messages in the queue.