2

I am working on developing an application that uses Azure Service Bus Queues for distributing messages among the consumers. All my consumers are listening on a single queue. Here are few things that I want to clarify. Azure documentation on my concerns provide far less information

  1. If a single queue is used for all my consumers, will the deliveries happen in round robbin fashion like in RabbitMQ
  2. Is there an Azure service bus equivalent to RabbitMQ basicQos
  3. How to handle manual acks from consumers. The Azure documentation uses a callback-based approach which is not what I need in my case.

Thanks in advance

Klaus
  • 1,641
  • 1
  • 10
  • 22

1 Answers1

2

If a single queue is used for all my consumers, will the deliveries happen in round robbin fashion like in RabbitMQ

Yes.
Sending 10 messages to a queue with two consumers I get: enter image description here

Is there an Azure service bus equivalent to RabbitMQ basicQos

Which features of RabbitMQ basicQos you are looking for?

How to handle manual acks from consumers. The Azure documentation uses a callback-based approach which is not what I need in my case.

You can use IReceiverClient.CompleteAsync (marks the message as being consumed) and IReceiverClient.AbandonAsync (unlocks the message and makes it available to be received again)

Pedro Perez
  • 842
  • 6
  • 23
  • basicQoS feature where channel will not send messages to consumers until the acknowledgement is received from consumer. – Klaus Sep 22 '20 at 12:56
  • Here you have the same behavior. Service Bus waits for the consumer acknowledgement. If the consumer `complete` the message, no other consumer will receive the message. If the consumer `abandon` the message, the message is available again and it will be sent to the same consumer, or to another consumer. – Pedro Perez Sep 22 '20 at 13:41
  • You need of course set `AutoComplete = false` in the consumer. – Pedro Perez Sep 22 '20 at 13:43
  • can you share me the code you used in the above example – Klaus Sep 22 '20 at 13:44
  • I just follow this tutorial [Get started with Service Bus queues](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dotnet-get-started-with-queues) – Pedro Perez Sep 22 '20 at 13:48
  • I want to know if there is a mechanism to stop sending messages to a consumer when there are number of unacked messages from that consumer. In rabbitMq, by setting basicQoS value, we can instruct rabbitmq not to send messages to a consumer when it has unacked messages. Is there a similar thing in ASB? – Klaus Sep 23 '20 at 03:37
  • I do not know that mechanism. Maybe you can use [MaxDeliveryCount property](https://learn.microsoft.com/en-us/dotnet/api/microsoft.servicebus.messaging.queuedescription.maxdeliverycount?view=azure-dotnet). – Pedro Perez Sep 23 '20 at 10:09