Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the ApproximateMessageCount property on an Azure Storage queue nullable?

The title pretty much explains my question:

If there are no messages in the Storage Queue, why would it not just return 0, assuming we were able to get the queue reference and make a connection? Instead, it returns null.

Does it have to do with the fact that the message count is "approximate?" Curious, more than anything.

like image 800
Mark C. Avatar asked May 18 '16 16:05

Mark C.


1 Answers

The approximate message count starts as null to indicate that it has not been initialized. After the first call to FetchAttributes, it is populated with the current value from the service. If there are no messages in the queue at this point then the value returned is zero.

like image 199
Michael Roberson - MSFT Avatar answered Sep 21 '22 12:09

Michael Roberson - MSFT