Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure queue - can I verify a message will be read only once?

I am using an Azure queue and have several different processes reading from the queue.
My system is built in a way that assumes each message is read only once.
This Microsoft article claims Azure queues have an at least once delivery guarantee which potentially means two processes can read the same message from the queue.
This StackOverflow thread claims that if I use GetMessage then the message becomes invisible to all other processes for the invisibility timeout.

Assuming I use GetMessage() and never exceed the message invisibility time before I DeleteMessage, can I assume I will get each message only once?

like image 641
Gilad Gat Avatar asked Nov 28 '12 09:11

Gilad Gat


People also ask

What is dequeue count in Azure queue?

This count is maintained by Azure Queue service, this is per message count. The DequeueCount element has a value of 1 the first time the message is dequeued. This value is incremented each time the message is subsequently dequeued.

What is the maximum size of a single queue message in Azure queue storage?

A queue message can be up to 64 KB in size. A queue may contain millions of messages, up to the total capacity limit of a storage account.

What is the difference between Azure storage queue and Service Bus queue?

Storage queues provide a uniform and consistent programming model across queues, tables, and BLOBs – both for developers and for operations teams. Service Bus queues provide support for local transactions in the context of a single queue.


1 Answers

I think there is a property in queue message named DequeueCount, which is the number of times this message has been dequeued. And it's maintained by queue service. I think you can use this property to identify whether your message had been read before.

https://docs.microsoft.com/en-us/dotnet/api/azure.storage.queues.models.queuemessage.dequeuecount?view=azure-dotnet

like image 131
Shaun Xu Avatar answered Oct 03 '22 22:10

Shaun Xu