Q18.Briefly explain Service Bus Queues?
Service Bus Queue is a messaging system and is a messaging service of the Azure platform. It is used for communication between distributed applications. Messages are sent by the sender application and stored in the Service Bus Queue. The message sender is responsible only to send messages. The messages stay in the queue waiting to be picked by the receiver (receiver applications).
The receiver application pulls the message from the Queue and processes it whenever required. The Queue is an intermediary between the sender and the receiver and hence sometimes is referred to as the broker. The Queue system operates based on FIFO based delivery, which means that the order in which messages are added to the Queue are processed by the message receivers in the same order.
There are two scenarios in which Service Bus queues are used.
- For web roles and worker roles of a Windows Azure Cloud service application to communicate with each other. ( you can read about roles in the coming questions)
- For on-premise applications and Windows Azure hosted apps in a hybrid solution.
The messaging system stores messages until the receiver requires to receive a message. This allows the components of the distributed application to not be online all the time, and whenever necessary they can be online and receive a message.
Now consider processing of a Sales Order in the Inventory Application. The worker role which processes each Sales Order takes the same time for each processing. If the Queue size increases, which means the number of sales orders have increased, we can scale the application by increasing the number of worker role instances.
This results in balancing of the load among more number of worker role instances. So, a benefit of the Queue system is that components of the application whether they are residing in an on-premise or on Cloud, can reside in a de-coupled state and scaling can be done in a systematic manner.
A receiver reads a message in the Queue in the following two ways. They are ReceiveAndDelete and PeekLock.
ReceiveAndDelete -The message receiver picks a message from the Queue and deletes it in the Queue. If the receiver crashes before it processes the message then the message will be lost forever.
PeekLock - The message receiver picks a message from the Queue and removes it from the Queue but will not delete the message. It locks the message so that other receivers cannot pick up the same message.
If the message receiver processes the message successfully, Complete method is called. This signals the Queue system to the delete the message in the Queue. If the message receiver is not able to process the message, the Abandon method is called. The Queue system removes the lock from the message and from then on, that message is available to other receivers. If the message receiver does not call either of the messages within a period of time, the Queue system recognizes this and makes the message available to other receivers.
Important words:
A distributed application is one which can run on one or more machines and is usually installed on a server.
Hybrid solution in this context refers to a solution which can run a part of the application on on-premise and another part of the application on the cloud.
An Inventory application is one which can maintain stock levels of an organization
The receiver application pulls the message from the Queue and processes it whenever required. The Queue is an intermediary between the sender and the receiver and hence sometimes is referred to as the broker. The Queue system operates based on FIFO based delivery, which means that the order in which messages are added to the Queue are processed by the message receivers in the same order.

There are two scenarios in which Service Bus queues are used.
- For web roles and worker roles of a Windows Azure Cloud service application to communicate with each other. ( you can read about roles in the coming questions)
- For on-premise applications and Windows Azure hosted apps in a hybrid solution.
The messaging system stores messages until the receiver requires to receive a message. This allows the components of the distributed application to not be online all the time, and whenever necessary they can be online and receive a message.
Now consider processing of a Sales Order in the Inventory Application. The worker role which processes each Sales Order takes the same time for each processing. If the Queue size increases, which means the number of sales orders have increased, we can scale the application by increasing the number of worker role instances.
This results in balancing of the load among more number of worker role instances. So, a benefit of the Queue system is that components of the application whether they are residing in an on-premise or on Cloud, can reside in a de-coupled state and scaling can be done in a systematic manner.
A receiver reads a message in the Queue in the following two ways. They are ReceiveAndDelete and PeekLock.
ReceiveAndDelete -The message receiver picks a message from the Queue and deletes it in the Queue. If the receiver crashes before it processes the message then the message will be lost forever.
PeekLock - The message receiver picks a message from the Queue and removes it from the Queue but will not delete the message. It locks the message so that other receivers cannot pick up the same message.
If the message receiver processes the message successfully, Complete method is called. This signals the Queue system to the delete the message in the Queue. If the message receiver is not able to process the message, the Abandon method is called. The Queue system removes the lock from the message and from then on, that message is available to other receivers. If the message receiver does not call either of the messages within a period of time, the Queue system recognizes this and makes the message available to other receivers.
Important words:
istributed applications
A distributed application is one which can run on one or more machines and is usually installed on a server.
hybrid solution
Hybrid solution in this context refers to a solution which can run a part of the application on on-premise and another part of the application on the cloud.
Inventory application
An Inventory application is one which can maintain stock levels of an organization
See More Questions and Answers on - "Components of Azure Platform"
- Briefly explain Azure virtual machines?
- Briefly explain Azure websites?
- What are the components of Azure platform?
- Explain the storage service of Azure OS?
- What are the other services in Azure OS?
- Azure OS vs Windows OS?
- What is Appfabric?
- Briefly explain service bus topics and subscriptions?
- What are Azure access control services ?
- What is Azure fabric controller?
- What is a scalable cloud application?