Reputation: 2008
I'm just learning about Queue Storage Message-triggered Azure Functions. I'm able to generate a message and trigger the Function, but where do the messages go once the Function ack's them?
They just disappear from the Queue.
Ideally I want to tell the Queue when to "dequeue" the message rather than it being automatically handled somehow.
Upvotes: 0
Views: 1300
Reputation: 790
Azure Storage Queues
have a Delivery Guarantee
of At least once
, meaning once you receive a message it'll be dequeued and becomes invisible for visibilitytimeout
duration which has a default value of 30 seconds
. It will not be automatically deleted and you'll need to explicitly delete the messages from your Azure Storage Queue
otherwise they'll show up again in the queue after the visibilitytimeout
. Here is some useful links
Storage Queue Introduction: https://learn.microsoft.com/en-us/azure/storage/queues/storage-queues-introduction
Get Messages Operation: https://learn.microsoft.com/en-us/rest/api/storageservices/get-messages
Storage Queue vs. Service Bus Queue: https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-azure-and-service-bus-queues-compared-contrasted
Upvotes: 0
Reputation: 136356
I'm able to generate a message and trigger the Function, but where do the messages go once the Function ack's them?
A message is dequeued from the queue when the Function is invoked. As part of the dequeuing process, the message becomes invisible for a certain amount of time (specified via visibility timeout duration). This is needed so that only one consumer processes a message at any given point of time.
If the Function is able to process the message successfully, it will be automatically deleted. You can't really control that behavior.
If the Function is not able to process the message, the message will reappear in the queue after it's visibility timeout duration expires and will be picked up again by another instance of Function.
Once a message has been retried "n" number of times and the result has always been unsuccessful, Function puts the message in a deadletter/poison queue that I believe will have the the name like <yourqueuename>-poison
.
Upvotes: 1