azure-service-bus icon indicating copy to clipboard operation
azure-service-bus copied to clipboard

Rate Limiting on queue subscriber

Open namansukhwani opened this issue 1 year ago • 0 comments

Can we have a feature of rate limiting the processing for the messages in the subscriber? Like I have applied a rate limit 5 messages per sec on my queue receiver, this rate limit should work for all receiver available on multiple deployed pods. Now only total of 5 messages should be processed in a sec over all the subscribers in multiple pods.

Similar to the implementation that is provided by Bull Queue, i.e.

It is possible to create queues that limit the number of jobs processed in a unit of time. The limiter is defined per queue, independently of the number of workers, so you can scale horizontally and still limiting the rate of processing easily:

// Limit queue to max 5 jobs per 1 second.
const myRateLimitedQueue = new Queue('rateLimited', {
  limiter: {
    max: 5,
    duration: 1000
  }
});

namansukhwani avatar Aug 10 '22 19:08 namansukhwani