Q19. Briefly explain Service Bus Topics and Subscriptions?

The second brokered messaging system offered by Service Bus topics is the publish/subscribe messaging system. This messaging system is similar to the Queue messaging system. There is a sender of messages and a Topic which holds all these messages. The difference between the earlier messaging system and this one lies in the way the subscriber receives the message. The subscriber subscribes to the Topic and defines a set of conditions for receiving the messages. The Topic messaging system makes available only those messages which satisfy the filter condition set by the subscriber.

We use Topics and Subscriptions in a distributed application to communicate between the components of applications.

In a future set of questions and answers I will demonstrate how to use the messaging system in a Sales Order Management application.

Note that a particular message in Topic can be received by multiple subscribers. This is a superior messaging system as multiple applications can pickup and process a particular message. Another benefit of this messaging system is that a part of a message or the full message can be read and processed by the receiver applications. As in Queues, subscribers can read messages in the Topic using either ReceiveAndDelete or PeekLock.

service bus topics and subscriptions

Refer above Fig. When a message is sent to a Topic by the message sender, it is available to each message receiver for handling the message and process it.

For applications sending large number of messages to large number of users and applications, this messaging system is preferred. This is because applications can receive messages independently and a single message can be read by multiple applications. When a new application needs to access the messages, new subscriptions can be added allowing large sized scaling.

Important words:


A Subscriber is one who register himself to avail a service. In windows azure a subscriber is one who has registered himself providing all the details and also has agreed to avail a particular plan of service. Note that, Microsoft has been changing the plan details and this can cause a bit of confusion if you do not frequently update yourself with these changes.