Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Feature] Azure Service Bus: no option for prefetch on subscriptions

Open Beginner friendly
#4,532 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
azure, csharp
Domain
backend

Research direction

Start by reading ServiceBusReceiverProvider and AzureServiceBusSubscriptionConfiguration, then follow how the configuration reaches the receiver options. Done means the subscription configuration exposes PrefetchCount with a default of 0 and passes its value to the receiver options; check the relevant tests for default and configured values.

Written by the indexing model from the issue text.

Description

.NET 0 - Backlog feature request help wanted V10.X

One thing I couldn't find on the ASB side is prefetch.

ServiceBusReceiverProvider now only sets ReceiveMode on the receivers, which leaves PrefetchCount at 0. BufferSize looks similar, but it's just the max count for a single ReceiveMessagesAsync call, and without prefetch each of those calls goes to the broker. Microsoft's prefetch page explains the difference better than I can, and even gives some tips on performance. (On RMQ bufferSize already becomes the channel prefetch through BasicQos.)

Describe the solution you'd like

Could AzureServiceBusSubscriptionConfiguration get a PrefetchCount, default 0, that's passed to the receiver options? On master it could go the same way MaxAutoLockRenewalDuration does.

I wouldn't tie it to bufferSize though. With peek lock the lock timer starts when a message lands in the prefetch buffer, and with a big buffer and slow handlers locks can run out before the handler even gets the message. Microsoft's rule of thumb is a lock longer than it takes to process the whole buffer plus one message. The renewal on master already skips messages with an expired lock in CanDispatchAsync, so at least those don't reach the handler.

Describe alternatives you've considered

You can get it today by subclassing ServiceBusClient (CreateReceiver and AcceptNextSessionAsync are virtual), setting PrefetchCount in there and returning that client from your own IServiceBusClientProvider. It works, but it hits every subscription using that provider, and a per-subscription setting would be nicer.


Prepared with help of an AI assistant.

Dominant language
C#
Stars
2.5k
Forks
301
Avg merge
1d 2h
Merged PRs (30d)
87

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from BrighterCommand/Brighter

All issues in BrighterCommand/Brighter

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.