
Overview
What is Azure Bus?
Azure Service Bus communication options
What is a Queue?
Implementing Queue in Service Bus
Monitoring Queues in Service Bus
Overview
Today when you write an application, your application needs data. This data can be from some backend system or from some external source. This backend system can be other applications or services. Also, the communication pattern has changed. Applications are no longer limited with simple request-response patterns and need more robust message exchange patterns, triggered by multiple events. This gives rise to a question of the type of communication method you use for your application. The traditional method is not enough and hence an advanced “Messaging System” is needed. Also, your application needs some sort of infrastructure which is difficult to maintain and ensure available. Here is when Azure PaaS computing model of Service Bus comes into the picture.
Need for Service Bus Architectural Pattern

Traditionally a business requirement is addressed as a separate process and usually, you will find duplication of functionality at some stage. As in the example above, considering an application that has an Email, Calendar and Play Store functionality each is storing login and user details separately. This will create a lot of complexity and inefficiency. Login and User details will have to be synchronized every time for any changes. Also, a user will have to create separate accounts for each process and will have to remember the same for access.
To fix the issue, the approach is to identify the common tasks and implement them by decoupling the functionality from each process and build a separate standalone application for authentication and user details.

As you can see in the figure above, the shared task for maintaining account related information is separated from the individual processes and is implemented as a service. This Asynchronous messaging scenario called, “Message Bus” is more efficient and highly scalable. It is defined as:
“A Message Bus is a combination of a common data model, a common command set, and a messaging infrastructure to allow different systems to communicate through a shared set of interfaces”
– Enterprise Integration Patterns
What is Azure Service Bus?
Azure Service Bus messaging is a reliable system to deliver information. It is flexible enough such that your applications or services may interact with each other either it be running in the cloud or on-premises. Azure Service Bus is also a multi-tenant messaging system i.e. a single service is shared across by multiple users. There are multiple communications options in Service Bus like Queues, Topics, Relays and Event Hub. You may use one or all four types of communication option depending on the type of application you are designing.
Azure Bus communication options
As mentioned earlier, there are four different messaging options available in Azure. Below is a brief description of each of them.
-
Queues
- Messages are Ordered (i.e. First In, First Out (FIFO))
- Ordered at arrival (broker assigns strongly monotonic sequence number to each msg)
- Time stamped on arrival (authoritative clock)
- Stored in SQL; once accepted, the message is as safe as any data in the SQL deployment
- Multiplexing with sessions
- Two models: Pull and Forward
- Pull – delivers messages on request, allowing concurrent readers
- Forward – delivers messages to single forward destination
- Poison Message Detection
- Dead Letter Queues
- Queue forwarding
- Messages are Ordered (i.e. First In, First Out (FIFO))
-
Topics
- All features of Queues, plus
- Multiple, Independent Subscriptions
- Named, durably created (optional)
- Quota: Up to 2000 concurrent subscriptions
- Reco is to start partitioning much, much earlier
- Rules with filter conditions on msg headers
- Quota: Up to 2000 rules per subscription
- Optional action set/modify message props
- Each rule hit yields a message
- Named, durably created (optional)
- Topic ‘tail’ and subscription ‘head’ are fully protocol compatible with Queues
-
Relays
- Relays support bi-directional communication
- No ports required, used outbound connection
- WCF bindings
- No libraries for non-Windows application
- On demand creates relay
- Relay deleted when connection is dropped
-
Event Hubs
- Large-scale data intake
- Used for applications require High throughput and Event processing
- Partitioned ordered sequence
- Data is retained in partitions
- Events cannot be deleted, removed as per retention policy
- 4 partitions by default can be from 2 to 32 partitions
What is a Queue?

Imagine you walk into a mall and after your shopping, you go towards the checkout counters. At the counter, you find other customers waiting in a “queue” for their turn to be addressed by the cashier. The first customer in the queue is addressed first by the cashier. The concept is the same in the Service Bus queue. A sender sends a message to the Service Bus queue and the receiver addresses the message.
Delivery Options
- Receive and Delete
- Fastest. Message lost if receiver crashes or transmission fails.
- Peek Lock
- The message is locked when retrieved. Reappears on broker when not deleted within lock timeout.
- Session + Peek lock
- The message is locked along with all subsequent messages with a same session-id ensuring order.
Message Model
- Brokered messaging properties are not SOAP headers
- System properties have special meaning to the broker or set by the broker
- Properties are key/value pairs that may very well carry payloads
- It’s not uncommon to have messages with empty message bodies
- Message bodies are useful for a single opaque payload not exposed to the broker (e.g. encrypted content)
Implementing Queue in Service Bus
More about implementing Queues in Service Bus
Monitoring Queues in Azure Bus
More about monitoring Queues in Service Bus
Learn more about Netreo.