Search code examples
azureazure-servicebus-queuesazure-servicebus-topics

Azure Service Bus Topic subscription concurency


I have following requirement

Message published to the Topic/Queue

Multiple consumers subscribed to the Topic/Queue. So our requirement is to only one consumer should listen to the message. That means no other consumer can get the same message.

I feel queue would be the best fit. But I have advise from our architect to check whether we can achieve it from Topics?.

So any body please let me know whether we can achieve it through Topics and also pros and constrains?

Thanks.


Solution

  • Azure Service Bus Queue is a single message queue. You send it a message and the message receiver will get the message and be able to process it accordingly. Each message will only be handled once.

    Azure Service Bus Topic is a more robust message queue than Azure Service Bus Queue. With Topics there can be multiple Subscriptions configured to catch messages based on a Filter. If multiple Subscriptions have a Filter that matches an incoming message, then each of those Subscriptions will get a copy of the messages. With Topics it's up to you to configure the Subscription Filters according to your projects needs.

    If you know a message only needs to be handled once in your system and the message queue is being used by a single message receiver application (single or multiple hosted instances) then Azure Service Bus Queue is likely the tool for the job.