Azure Function and Azure Storage Queue Design Question

Glen Rohrer 1 Reputation point
2021-10-21T18:06:12.557+00:00

I have a business process that involves 10 different tasks. These tasks do not have a dependency on each other.

What is the best approach:

Option A:
Create a SINGLE Azure Function that contains code for ALL 10 steps, that is triggered by a single Storage Queue.
The function would read a queue message and determine which task of 10 it should execute.

Option B:
Create 10 separate Azure Functions for each task, which are triggered by their own distinct Storage Queue.

It seems that creating a Function for each tasks seems to be in the spirit of functions (microservice).
But creating 10 different storage queues seems to be a lot.

And I don't believe multiple Functions can access a single storage queue?

Any help and feedback would be appreciated!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,908 questions
Azure Storage
Azure Storage
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,529 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Samara Soucy - MSFT 5,141 Reputation points
    2021-10-21T18:25:16.11+00:00

    There are a couple different options here that I think are worth considering. Either of the ones you wrote about would work as well, but I think either of these would work out better.

    1. Make use of the durable function framework. This allows you to have an activity function for each step, while still using the single queue. The orchestration function would be in charge of determining which of the activity function(s) need to be run based on a given message. This way each function only has a single task, which is recommended, but you have a "hub" that routes messages between those functions.
    2. Leverage Service Bus topics instead of storage queues. Storage and Service Bus queues allow multiple receivers, but each message will be processed once, so each receiver needs to be able any message. In contrast, Service Bus Topics create a one-to-many relationship, where each subscription gets a separate copy of each message. So in this case you would have one topic and 10 subscriptions- one for each task/function. You can use filters on the subscriptions to determine which function receives a given message, or have each function determine that in their code.
    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.