I'm using the Microsoft.WindowsAzure.Storage.Queue library to push messages to an Storage Queue from an Azure Function with the following code:
public void Enqueue(MyMessage myMessage)
{
string originalPayload = null;
try
{
payload = serializer.Serialize(myMessage);
var message = new CloudQueueMessage(payload);
cloudQueue.AddMessage(message);
}
catch (Exception ex)
{
throw ex;
}
}
This works for small volumes, but when processing around 200 messages per 5 minutes, almost half of the messages do not make it to the queue even though the function never fails and shows as successful for all attempts.
So I want to add a verification step after pushing the message and I was thinking if just a PopReceipt check would work:
if ( string.IsNullOrWhitespace(message.PopReceipt) )
{
// the message was not added, do something
}