0
votes

My scenario: I have an Azure Storage Queue where messages can come in at any time. If I have 10 items in that queue, it's imperative that they be processed in order. I'm using c# and the windows azure storage SDK.

If the first item fails after, say, 2 seconds it remains invisible on the queue for another 28 seconds (30 second invisibility by default).

Now, my worker will just continue to check a queue for messages and process them as and when. If a queue message fails, it remains invisible and so the next queue item will be processed before the first message is retried.

This seems like really basic functionality for anyone needing a queue where the items are processed in order.

No, I can't set the timeout to a smaller amount because tasks can take varying lengths of time.

1
You cannot guarantee order for Azure Storage Queues. No matter what the invisibility setting. If you need ordered queue content, you'd need to shift to Service Bus queues.David Makogon

1 Answers

2
votes

George, if you are looking for a messaging queue solution that processes items in order, you should consider using Azure Service Bus Queues:

As a solution architect/developer, you should consider using Service Bus queues when:

Your solution must be able to receive messages without having to poll the queue. With Service Bus, this can be achieved through the use of the long-polling receive operation using the TCP-based protocols that Service Bus supports.

Your solution requires the queue to provide a guaranteed first-in-first-out (FIFO) ordered delivery.

You want a symmetric experience in Azure and on Windows Server (private cloud). For more information, see Service Bus for Windows Server.

Your solution must be able to support automatic duplicate detection.

There is a good article comparing both Storage Queues and Service Bus: https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-azure-and-service-bus-queues-compared-contrasted , you may find the latter better suitable for your case.