0
0
Azurecloud~10 mins

Service Bus topics and subscriptions in Azure - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Service Bus topics and subscriptions
Send message to Topic
Topic receives message
Distribute message to Subscriptions
Each Subscription stores message
Subscribers receive messages from their Subscription
Message processed and removed from Subscription
Messages are sent to a topic, which then distributes copies to each subscription. Subscribers read messages from their subscriptions independently.
Execution Sample
Azure
Create Topic 'orders'
Create Subscription 'priority'
Send message 'Order1' to Topic
Subscription 'priority' receives 'Order1'
Subscriber reads 'Order1' from 'priority'
This sequence shows sending a message to a topic and a subscription receiving and processing it.
Process Table
StepActionTopic StateSubscription 'priority' StateSubscriber Output
1Create Topic 'orders'Topic 'orders' created, emptySubscription 'priority' does not existNo output
2Create Subscription 'priority'Topic 'orders' existsSubscription 'priority' created, emptyNo output
3Send message 'Order1' to TopicTopic 'orders' has message 'Order1'Subscription 'priority' emptyNo output
4Topic distributes 'Order1' to subscriptionsTopic 'orders' has message 'Order1'Subscription 'priority' has message 'Order1'No output
5Subscriber reads message from 'priority'Topic 'orders' has message 'Order1'Subscription 'priority' empty after readSubscriber received 'Order1'
6Message processed and removedTopic 'orders' has message 'Order1'Subscription 'priority' emptySubscriber processed 'Order1'
💡 Message processed and removed from subscription; subscriber output complete.
Status Tracker
VariableStartAfter Step 2After Step 3After Step 4After Step 5Final
Topic 'orders' messagesnonenone'Order1''Order1''Order1''Order1'
Subscription 'priority' messagesnonenonenone'Order1'nonenone
Subscriber outputnonenonenonenone'Order1''Order1 processed'
Key Moments - 2 Insights
Why does the topic still have the message after the subscriber reads it from the subscription?
The topic keeps the original message until it expires or is removed; subscriptions hold copies. See execution_table step 5 where subscription is empty but topic still has the message.
Can multiple subscriptions receive the same message from a topic?
Yes, each subscription gets its own copy of the message from the topic. This is shown in the concept flow where the topic distributes messages to all subscriptions.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table at step 4. What is the state of the subscription 'priority'?
AHas message 'Order1'
BSubscription does not exist
CEmpty, no messages
DSubscriber has read the message
💡 Hint
Check the 'Subscription 'priority' State' column at step 4 in the execution_table.
At which step does the subscriber receive the message 'Order1'?
AStep 3
BStep 4
CStep 5
DStep 6
💡 Hint
Look at the 'Subscriber Output' column in the execution_table to find when the message appears.
If a second subscription is added, how would the topic distribute messages?
AOnly to the first subscription
BTo both subscriptions independently
CMessages are split between subscriptions
DMessages are sent only once to the topic
💡 Hint
Refer to the concept_flow where the topic distributes messages to all subscriptions.
Concept Snapshot
Service Bus topics receive messages from senders.
Each subscription gets a copy of every message.
Subscribers read messages independently from their subscriptions.
Messages remain in topic until expired or removed.
Subscriptions act like message inboxes for subscribers.
Full Transcript
Service Bus topics act like message hubs. When a message is sent to a topic, it keeps the message and copies it to each subscription. Each subscription stores its own copy. Subscribers read messages from their subscriptions, not directly from the topic. This allows multiple subscribers to get the same message independently. Messages stay in the topic until they expire or are deleted. Subscriptions act like inboxes holding messages for subscribers to process.