3

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.

Chris Pietschmann
  • 29,502
  • 35
  • 121
  • 166
Chandra Mohan
  • 729
  • 2
  • 10
  • 29

1 Answers1

3

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.

Chris Pietschmann
  • 29,502
  • 35
  • 121
  • 166
  • There could be multiple receiver application So in that case also can i go with Service Bus Queue? – Chandra Mohan Mar 18 '16 at 05:34
  • @ChandraMohan If you mean multiple instances of the same application, then yes Service Bus Queue could still be used. – Chris Pietschmann Mar 18 '16 at 17:57
  • @Pietschmann The last question before i mark it as answer, Actually we own the subscription part.While testing initially I found the same message is publishing to different receivers. But later it was not able to reproduce. At a time only one receiver is received message. So My question is will there may be any chance we get same message published to different subscribers(may be different instances or different applications but with the same topic and subscription name using subscription client)? – Chandra Mohan Mar 19 '16 at 02:49
  • To give more clarity to my above question i am having one publisher multiple receivers. Sending one message expecting that message should only be received by one receiver.I am using same topic and same subscription name to create subscription client.Yes Service bus queue would be suit for our requirement.But we wanted to have filters and more robust functionality. So we wanted to go with topics. – Chandra Mohan Mar 19 '16 at 03:02
  • @ChandraMohan If you only have 1 message type that will only be handled a single time by a receiver, then Service Bus Queue sounds like what you should use. If you need to eventually handle multiple different types of messages and/or have multiple subscriptions handle messages then Topics is best. Hope this is helping. Please mark answer as correct if so. – Chris Pietschmann Mar 23 '16 at 02:12
  • There is no difference between the "robustness" of Azure Service Bus Topic / Subscription vs. Azure Service Bus Queue. It is the same technology. If you want to go more robust, create a partitioned version of either. The Queue offers the Competing Consumer pattern, while Topic / Subscriptions offers the Parallel Consumer pattern. Note that you can think of a Subscription merely as a Queue that gets a copy of the message sent to the Topic if the subscription filter is a match. As such, each Subscription also offers the Competing Consumer pattern. – Jacques Bosch Jan 14 '17 at 21:13