This is the first of two post that will illustrate how to write and read messages from Azure service bus queues. The second post will actually illustrate how to read these messages using Node.js.
What I like about this post is that it only took a few minutes to complete.
This post is here to support an MSDN article that I am writing with Steven Edouard.
The assumption here of course is that you have opened an account with Windows Azure.
The first order of business is to actually create the service. You will need to go to the Azure portal click on the service bus , then New in the lower left corner.
Figure 1: Creating a new service bus queue
Select Queue , Custom Create .
Figure 2: Selecting Custom Create
Figure 3: Configuring the service bus queue
We will accept the default values here.
Figure 4: Specifying the queue name and namespace
You can see the created namespace in the portal once it is complete.
Figure 5: Validating the creation of a service bus queue
In the figure above you can click on connection information . Specifically, you will need the connection string . The connection string will be pasted into the app . config file of a Visual Studio project we are about to download.
Figure 6: Viewing connection information
Here is the sample to illustrate how to write and read to Azure Service Bus Queues. This is the download link:
Figure 7: Downloading the Service Bus Sample
The modifications will be quite simple. The only thing that we will need to do is modify the connection string in app.config
Figure 8: Viewing the solution
You can see below that we have modified the connection string . You will need to paste in the connection string you obtained from the portal .
Figure 9: Viewing and modifying App.config
Let's take a brief look at the actual code that reads and writes to the message queue.
Screen below shows messages that are being written to the message queue.
Figure 10: Viewing queue creating and message sending
As the program progresses, it will actually display the messages that are read from the message queue . In a future post we will show how to do this from node.JS
Figure 11: Viewing messages in the queue
When messages are read from the message queue , they are removed . Because we want these messages to remain in the queue so that our node.JS program can read them, you should think about commenting out the code that reads messages from the queue . Alternatively, you can use the Peek () method to read messages, but not remove them from the queue.