In what sequence does a Webjob on an Azure App Service process messages from multiple queues?

Beau Tang 6 Reputation points
2021-12-21T09:46:45.22+00:00

Hi all,

Say I have an webjob monitoring two queues A and B, and messages appear on the queues in this sequence

  • 100 messages for queue A
  • 1 second later, 2 messages for queue B

Will those 100 messages in queue A be processed before the 2 in queue B or will the messages in queue B skip ahead of the bulk of those queue A messages?

Many thanks.

Beau.

Azure Queue Storage
Azure Queue Storage
An Azure service that provides messaging queues in the cloud.
109 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,915 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Julian Hüppauff 341 Reputation points Microsoft Employee
    2021-12-21T15:07:54.523+00:00

    I am not sure how you monitor the queues.

    If you are using multiple QueueTrigger those will be handled most likely in parallel depending on the polling interval.

    Also keep in mind that Azure Storage Queues do not support First in first out.
    https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-azure-and-service-bus-queues-compared-contrasted#foundational-capabilities

    If the order between is important then you might need a custom implemetation which checks and process the queues in order.

    1 person found this answer helpful.

  2. SnehaAgrawal-MSFT 21,771 Reputation points
    2021-12-27T12:12:02.233+00:00

    You may want to know that the QueueTrigger attribute tells the runtime to call this function when a new message is written on an Azure Storage queue called queue and when there are multiple queue messages waiting, the queue trigger retrieves a batch of messages and invokes function instances concurrently to process them.
    Check this document: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue-trigger?tabs=csharp#concurrency

    1 person found this answer helpful.

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.