Lesson 1 of 6 Application Architecture Solutions

Choosing Between Service Bus and Queue Storage

This lesson explains why applications are decoupled, and how to select a queue.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish messages from events.
  • Describe Service Bus features and tiers.
  • Choose a messaging service from stated requirements.

Why decouple

When one component calls another directly, both must be available at the same moment and both must handle the same load. A queue placed between them changes this relationship. The sender writes a message and continues, and the receiver processes messages at its own pace. If the receiver fails, messages wait. If traffic spikes, the queue absorbs the excess, a pattern known as queue-based load levelling.

A message differs from an event, and this distinction selects the service. A message is a command or data that the sender expects to be processed, and the sender cares about the result: process this order. An event is a lightweight notification that something has happened, and the publisher has no expectation about who reacts: a file was uploaded.

Sort into groups

Message or event?

Exam skills 4.2.1

Decide whether each item is a message or an event.

Log in to try this activity Interactive activities are free with an account.

Azure Queue Storage

Azure Queue Storage is a simple queue within a storage account. Messages can be up to 64 KB, and a queue can grow to the capacity of the account, up to 5 PiB, which suits very large backlogs. It has a simple REST interface, is inexpensive, and offers at-least-once delivery. It suits straightforward decoupling between tiers, when no advanced broker features are required.

Queue Storage has no ordering guarantee, no publish and subscribe, and no built-in duplicate detection. Application code must be idempotent, so processing the same message twice has no harmful effect.

Azure Service Bus

Azure Service Bus is a fully managed enterprise message broker. It supports queues for point-to-point delivery, and topics and subscriptions for publish and subscribe, in which each subscription receives its own copy of relevant messages, optionally filtered. It has a number of features that Queue Storage lacks.

  • Sessions group related messages and deliver them in first-in, first-out (FIFO) order.
  • Duplicate detection discards a repeated message within a configured time window.
  • Dead-letter queues hold messages that cannot be processed, for later inspection.
  • Transactions group several operations into one atomic unit.
  • Scheduled delivery and message deferral hold messages until they are needed.

Service Bus has three tiers. Basic offers queues only. Standard adds topics, sessions, transactions and duplicate detection, with a maximum message size of 256 KB. Premium provides dedicated messaging units, messages up to 100 MB over AMQP, virtual network integration and Private Link, geo-replication and JMS 2.0 support. Premium suits production workloads requiring predictable performance or isolation. Queues reach 80 GB on Premium, and on Standard with partitioning enabled; otherwise a Standard queue is limited to 5 GB.

Match the pairs

Service Bus features

Exam skills 4.2.1

Match each Service Bus feature with the problem it solves.

Log in to try this activity Interactive activities are free with an account.

Comparing the queues

The following comparison recaps the two queue services.

Azure Queue Storage
Maximum message size64 KB
Maximum queue sizeUp to 5 PiB
OrderingNo guarantee
Publish and subscribeNo
Duplicate detectionNo
Choose when Simple, very large queues at low cost
Azure Service Bus
Maximum message size256 KB (Standard), up to 100 MB (Premium)
Maximum queue sizeUp to 80 GB
OrderingFIFO with sessions
Publish and subscribeYes, topics
Duplicate detectionYes
Choose when Enterprise messaging features

The following diagram shows a Service Bus topic and its filtered subscriptions for payment instructions.

Payment instructions through Azure Service Bus Premium. A topic with filtered subscriptions delivers only relevant payments to each downstream system; sessions keyed by customer keep order; duplicate detection drops repeats; dead-letter queues keep failed messages; and Private Link, a Premium feature, keeps traffic private.
The scenario is illustrative.
Scenario questions

Which queue service and tier?

Exam skills 4.2.1

Choose the queue service and tier for each requirement.

Log in to try this activity Interactive activities are free with an account.
Worked example

Choosing a messaging service

A bank's payment service sends instructions to three downstream systems. Each system must receive only the payments relevant to it, each customer's payments must be processed in order, repeated instructions must be ignored, and failed messages must be kept for review. Traffic must stay on a private network. What should you recommend?

Azure Service Bus Premium meets the requirements. A topic with filtered subscriptions delivers only relevant payments to each system. Sessions keyed by customer give FIFO order, duplicate detection handles repeated instructions, and dead-letter queues hold failed messages. Private Link support requires the Premium tier.

Azure Queue Storage has no topics, ordering or duplicate detection. Azure Event Grid delivers notifications rather than commands with these guarantees, and Azure Event Hubs is built for high-volume event streaming, not for transactional commands to specific consumers.

Check yourself

When is Azure Queue Storage preferable to Service Bus?

Show answer

When simple queueing is sufficient at low cost, or when a backlog could exceed the 80 GB Service Bus limit.

Exam Tips

Remember for the exam

  • A message expects processing; an event announces that something happened.
  • Queue Storage: 64 KB messages, very large queues, no ordering.
  • Service Bus: topics, sessions, duplicate detection, dead-letter queues and transactions.
  • Premium is required for Private Link and for messages up to 100 MB.