In this video, learn about Azure topics and subscriptions. The demonstration includes implementing and configuring topics and subscriptions.
- [Instructor] One of the communications within the Azure service bus messaging service is topics and subscriptions. Let's go ahead and take a look at how this differs from the queues. Just like the Azure queue service, topics and subscriptions are a messaging Azure service feature within Azure. They also provide asynchronous or one way communication from our sender to our receiver. But the difference here is the receivers only know about the subscriptions and not the actual topic.
And this allows us to apply filters and actions to the subscriptions themselves. In our example here, we can see we have our message sender, which could be a web app, mobile app, or service. It then passes the message through to the topic. It will then filter the message and send it to the appropriate subscription. The receiver can then only access the subscription that it is associated with, assuring that it is only pulling those messages from that subscription.
Let's go ahead and take a look at a sample workflow. Here we have messages, one that has fulfilled in it and one that has order. When the sender sends that message, it goes to the topic, and then it'll be filtered to the subscription for fulfilled and then our receiver will then pull from that subscription. And the same process happens with our messages with order in it. The topic will send it to the subscription because it's being filtered on order and then the receiver will pull from that subscription.
Note that the receiver never ever communicates directly with the topic, only the subscription. Let's go head and create a couple of topics and subscriptions within Azure. As you can see, we've logged into Azure and we happen to be in our service bus called lilnamespace. We can see the queue that we created in our previous lesson. Now let's go ahead and create a topic. Click on Topic. Provide a name. I'm using liltopic.
I can select a maximum size of one to five gigabytes. We can set the message time to live, the default is 14 days. So you can adjust this as required. I will leave Enable duplicate detection turned off and Enable partitioning turned on. This will look very similar to when we created the queues. Go ahead and click Create. This will only take a moment. We can see our topic has now been created. And as we do not have a sender service, our topic is empty.
Now we can go ahead and add in subscriptions. Click on Subscription and provide a name. And you can change the message time to live, from 14 days, which is default. You can also change the lock duration and the maximum delivery count. You also have the option here to move expired messages to the dead letter subqueue. You can also move messages that cause filter evaluation exceptions to that dead letter queue. Maybe your filtering is causing the problem and those messages would then be sent over to that dead letter queue.
You can also enable sessions here if you'd like to as well. Go ahead and click Create. And that's all there is to creating a topic and in this case, a single subscription. The big difference between topics and subscriptions and queues is that receivers can only access the subscription to pull the message. The receiver can never speak to the topic directly.
- Creating compute-intensive applications
- Creating long-running applications
- Implementing messaging systems
- Azure Service Bus relays
- Using Azure Storage queues
- Creating an Azure Event Hub
- Creating Azure WebJobs
- Managing cloud environments with Azure Active Directory Domain Services