Patrik
Patrik

Reputation: 241

How can you configure different prefetch settings using ServiceBusTrigger in a azure function

Today i'm configuring PrefetchCount in startup.cs like below. However, we have multiple functions using the ServiceBusTrigger in the same project. How can I configure different PrefetchCount for each function?

builder.Services.Configure((ServiceBusOptions options) =>
{
    options.PrefetchCount = 20;
});

Upvotes: 0

Views: 265

Answers (2)

Pravallika KV
Pravallika KV

Reputation: 8744

  • As specified in this SO Answer given by @MikhailShilkov and MS Doc, if you define the PrefetchCount in host.json code, then it acts as a global configuration for all the functions in an Azure function project.

How can I configure different PrefetchCount for each function?

  • If all the functions are of same trigger type, then the recommended way by Microsoft is to define that setting in host.json and if it is function level code setting, then we can define in the Function Code like Function Disable attribute, it is proposed by @SeanFeldman in this SO answer.

Upvotes: 1

Sean Feldman
Sean Feldman

Reputation: 26057

Function App is configuration is applied to all Functions hosted in the same application. If you need to configure functions differently, you'll need to deploy those functions separately.

Upvotes: 2

Related Questions