Azure Service Bus Topics Sequence vs Sessions

Abhay Pratap Singh 0 Reputation points
2025-10-06T19:01:41.13+00:00

What exactly is the difference between retrieval order and process order, and how can we look/check/verify that without using a session we retrieve in the correct order, explain with an example of C # and . .NET.
Let me make it clearer,
I uploaded 1000 messages to Azure Service Bus.
I applied a ServiceBusTrigger onto an Azure Functions, And printing the message body then, the function is triggered 1000 times, as many messages are present on the service bu, but the catch is the retrieval order is random, not uniform as I uploaded, but this document says to maintain retrieval order, we don't need to use sessions.
How can we verify the retrieval order without using sessions
User's image

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Praveen Kumar Gudipudi 1,080 Reputation points Microsoft External Staff Moderator
    2025-10-06T20:33:22.6433333+00:00

    Hello Abhay Pratap Singh,

    Azure Service Bus guarantees FIFO (first-in-first-out) only within sessions. If you do not use sessions, strict global FIFO is not guaranteed, because messages may be delivered concurrently to multiple function instances or across partitions.

    However, there are some approaches to approximate FIFO without sessions:

    • Configure your queue for only one processing instance by limiting concurrency.
    • In Azure Functions, this means setting maxConcurrentCalls (Service Bus SDK) or host.json concurrency settings to 1. host.json Example for Single-Consumer: { "version": "2.0", "extensions": { "serviceBus": { "maxConcurrentCalls": 1 } } } Enabling the First-In-First-Out pattern in Microsoft Azure Service Bus Queues and Topics For true FIFO, using sessions is the recommended approach in Service Bus.

    Please accept as answer and do a Thumbs-up to upvote this response if you are satisfied with the community help. Your upvote will be beneficial for the community users facing similar issues.

    User's image

    0 comments No comments

Your answer

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