azure service bus queue with multiple listeners / competing consumers with queue azure service bus queue with multiple listeners / competing consumers with queue azure azure

azure service bus queue with multiple listeners / competing consumers with queue


There is a big difference between queues and topics: with queues, each message is picked up by only 1 consumer. With a topic, every consumer that subscribed to the topic will get each message (although there is room to filter...). If your scenario requires each message to be processed by only one consumer, use queues. If all of the registered processes need to work on it, use topics.

You can have multiple listeners to a queue. Let's say we have Process A and Process B that both listen to the queue. A message comes in, and Process A picks it up. If another message comes in and Process A hasn't finished yet, Process B will pick up the message. If Process A is ready, either one of the processes can pick up the second message.

Competing consumers

For more info on competing consumers, have a look at the Competing Consumers article on the Azure Architecture Center, complete with (references to) example code.