How to Use Azure Queue-Triggered Functions and Why
A step by step guide on how to process multiple items efficiently
Azure Functions, a service allowing to run serverless code, come in many forms: they can be HTTP triggered — you can call them directly to execute some code; blob-triggered — they run when a new blob is uploaded to storage, or, among other things, queue-triggered, which is what we are going to discuss here. If you’re not familiar with Azure Functions, read this first, and if you want to jump into the implementation of an Azure Python Function, refer to my last article.
A queue-triggered function executes code when a new message comes into a queue, a data structure from which you can retrieve items in the order they came in (we call this ordering principle FIFO: first in, first out). But why would you need to put messages into a queue?
Well, you would typically do this when you have several items to process, when these items can be processed independently and when processing them all at the same time would take too much time.
Azure Functions on a consumption plan have a limited lifespan: they’re meant to be small pieces of code that you can call whenever you need. They can run for a maximum of 10 minutes and if they’re HTTP-triggered, you should get the response within 230…