Windows Azure Service Bus

The Service Bus is a communication engine which provides secure and reliable communication between components. Service Bus allows you to build applications and connect with different roles between Web and worker TL, you can use this for load labeling and or for decoupling where your web TS sent messages into a queue. Service Bus is a unified set of messaging capabilities.

With Azure Service Bus you can build cloud scale applications for the enterprise. Service Bus provides you Messaging and Relay Services and really helps to unblock enterprise data as well as business logic.

With Service Bus you can enable loosely coupled solutions.

Window Azure Service Bus provides multi-tenant service to the connecting applications.

You can use four different communications mechanism of one or more instances within a namespace.

Queues: This allows one directional communications (also called Broker).

Topics: This allows one directional communications using subscriptions.

Relays: This is responsible to providing bi-directional communications. It passes the messages on to destination application.

Event Hubs: This is responsible to provide event and telemetry entry to the cloud.

The following figure shows, in a one namespace there may be many entities can be reside or created.


Now start with creating a new namespace, go to the Service Bus and click on to create a new namespace.


Namespace is a Global unique container. We can put all entities in namespace like Queues, Topics, Relays and Event Hubs. So now we need to create a namespace for Azure Service Bus, give a name to your service, type and messaging tier would by default add select the region where you want to create your Service Bus.

In the type, I’m selecting Messaging; Notification Hub is for how to send notifications to mobile devices.

So here, my Service Bus namespace has been created “MyServiceBusAzure”. Click on to namespace as shown in the following screenshot:


There are many entities inside the namespace like Queues, Topics, Relays, and Event Hubs.


Now first I’m going to create a Queue, click on QUEUE and click on “NEW” button in the bottom to create a Queue.


Inside Service Bus, click Queue, then Quick Create, a box would open for creating a new Queue, give a name to your queue, select the region for queue and namespace would be “MyServiceBusAzure”.

Click on to “Create a New Queue”.


So my Queue gets created, now what we can do with queue, queue is inside in my container (namespace). Here, I need a connection string of my queue, let’s check connection string is available at this time, for this go to “Connection Information”.


So there is no Shared Access Service (SAS) available at this time, make sure connection string is very important to communicate with this queue to my application. For access connection string you need to define what are the authorizations, what are the capabilities you can do, may be you can also create items in a queue, may be you can read items from a queue as well as you can manage your queue. Let’s see how we can configure that,


In CONFIGURE  tab, scroll down and you will see Shared Access policies, access policy is responsible to provide the access rights.


Let’s create a new permission, we have given it “WritePolicy” name to my policy, what are the permissions available, click on to dropdown. You can receive three things: you can manage, send and listen. I’m interested in sending, so I have selected Send.


I created a second policy that is “ReadPolicy”, so I select “Listen” permission for it.


Click on to “Save” button to save your policies.


Now I have two policies, now let’s see my Queue Dashboard, scroll down and select “View Connection String”.


Here you can see the End Points of both policies, If I want someone to write things in my queue I can give this connection string to that person as well as to read things I can give read connection string to that person.

connection string

Now you can check the same connection string of both polices in the Queue tab. Click on Connection Information at the bottom of the page.


Here in the following screenshot, you can see same result.

connection string

In TOPICS panel, click on to New button to create a new topic.


Give the name of topic and select region/location of the topic, select your namespace for it.

Click on to “Create a New Topic”.


Here my topic is ready.


Open Visual Studio and connect with your Azure, in the left side of the window in Server Explorer. In the left hand side of Server Explorer you can see that I have Service Bus namespaces list. Under Service Bus I have one namespace that is “MyServiceBusAzure”, in this I have one queue and one Topic that I have created in the Azure portal.


There is some additional debugging information, so right click on your queue and select properties.


In the following screenshot I have lots of information about my particular queue, like when the queue was created as well as important values like maximum delivery information and the max size of the queue.


In Visual Studio I also have capability to create a new queue object, right click on to Queues and select “Create New Queue”. We also create Topics through Visual Studio like Queue.


Give the name to your Queue, as well as you can modify all the key properties of that.

Click on to “Save” button to create your queue.

I hope you enjoyed this article. Stay tuned with me for more articles on Azure and other Microsoft technologies.

Connect (“Nitin Pandit”);

How it works


So, Azure Service Bus provides messaging capabilities where we can connect about anything like application, services and devices.

Read more articles on Azure