Microsoft Azure Service Bus provides an PaaS (Platform as a Service) communications platform built to allow more robust, multi-tenant software systems to be built in the cloud. There are four main feature sets within Azure Service Bus (Queues, Topics, Relays, and Event Hubs) that all offer different communications mediums for use with and between the different tenants of cloud hosted and hybrid (cloud and on-premises) hosted applications.
Azure Service Bus Namespace
The primary container that all of the Azure Service Bus services (Queues, Topics, Relays, and Event Hubs) reside within is an Azure Service Bus Namespace. The term Namespace can initially appear a bit ambiguous. The Service Bus Namespace offers a logical grouping of all related Service Bus services used within the same application.
An Azure Service Bus Namespace must first be created before any of the Azure Service Bus services can be created and used. There are a few different ways to create a new Azure Service Bus Namespace. The most straightforward method is to just login to the Azure Portal, and manually create the namespace.
While creating a new Azure Service Bus Namespace manually is easy enough to do, when automation or DevOps are factors within your team culture then you’ll likely need to script out the creation of the Azure Service Bus Namespace. Fortunately, there are few different ways to do this; these include: PowerShell, X-plat CLI, and .NET SDK.
Azure Service Bus Queue
The Azure Service Bus Queue feature offers easy to implement infrastructure for implementing brokered messaging communication.
Implementing a Message Queue requires the implementation of 2 tenants; a Sender and a Receiver. The Sender sends the messages into the Queue, and then the Receiver retrieves messages from the Queue; both asynchronously.
Service Bus Queues work on a “First In, First Out” model. The first message into the Queue will be the first out when a Receiver Application checks the queue for messages and grabs the next in the Queue.
Azure Service Bus Topic
Azure Service Bus Topic provides a “more robust” messaging queue infrastructure than that offered by Service Bus Queues. At it’s core, Service Bus Topic offers a very similar brokered messaging infrastructure. However, Azure Service Bus Topic offers a few additional features that make it more robust under certain circumstances.
Message Sender applications submit messages to an Azure Service Bus Topic in a similar fashion to Service Bus Queues. The main difference lies with how the messages are received via Subscriptions.
Azure Service Bus Topic implements a Publish / Subscribe model to the messaging queue. Each Service Bus Topic Subscription can optionally implement a Filter that specifies which messages it will receive. This allows for not just a single receiver to receive each message (as with Service Bus Queue), but with Azure Service Bus Topic multiple receivers can receive the same messages given that their Subscriptions have a Filter that catches the messages. Using Subscriptions also allows for the receiver to be automatically notified of new messages, rather than need to implement periodic polling.
Azure Service Bus Relay
Azure Service Bus Relay allows for on-premises WCF (Windows Communication Foundation) services to securely and easily accessed by applications in the cloud. Service Bus Relay also allows this to be done without requiring any additional open ports or firewall configurations.
Essentially, the WCF service configured to use Azure Service Bus Relay will connect outbound to Azure using a TCP connection. Then other applications can connect to the Azure Service Bus Relay endpoint, and Service Bus Relay handles tunneling the communications through the TCP connection.
Azure Service Bus Relay allows for secure connection to the WCF service since it relies on Azure security to establish and encrypt the connection / communication. By including the security of the Relay into the Infrastructure of the service, it takes the responsibility of implementing the best security off of the developers. This ensures that security is implemented correctly, by Microsoft Azure, so there aren’t any vulnerabilities introduced by the application developers.
Azure Event Hubs
Microsoft Azure Event Hubs is a highly scalable service that is built for handling millions of events / messages per second. This is a message queue built for the ingress of gathering high amounts of event data.
While Service Bus Topic or Queue could be used for the same purpose, the Azure Event Hubs are built to scale to the demands of Big Data and IoT (Internet of Things.)
Microsoft Azure Service Bus offers quite a wide range of infrastructure functionality. This post is basically just an introduction into what each of these services are. This is also the first is a series of coming posts on working with the Microsoft Azure Service Bus.