Azure / Azure/azure-functions-dotnet-worker

How to configure KafkaOptions at function level rather than using host.json file.

Open
#2,231 1 comment 0 reactions 1 assignee Claimed by @jainharsh98 View on GitHub
extensions: kafka needs-investigation
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

We are migrating in process Kafka consumer trigger to isolated worker process. we faced an issue with migrating kafkaoptions

this is how we have configured kafkaoptions earlier.

**services.Configure(opt =>
{
opt.SubscriberIntervalInSeconds = 1;
opt.AutoOffsetReset = Confluent.Kafka.AutoOffsetReset.Earliest;
opt.MaxBatchSize = 1;
opt.LibkafkaDebug = "all";
})**

where KafkaOptions is an Ioptions implementation

[https://github.com/Azure/azure-functions-kafka-extension/blob/135b227ff5b516abb3f8aa21a29065cff5e154bb/src/Microsoft.Azure.WebJobs.Extensions.Kafka/Config/KafkaOptions.cs](https://github.com/Azure/azure-functions-kafka-extension/blob/135b227ff5b516abb3f8aa21a29065cff5e154bb/src/Microsoft.Azure.WebJobs.Extensions.Kafka/Config/KafkaOptions.cs)

since we replaced **Microsoft.Azure.WebJobs.Extensions.Kafka** package with **Microsoft.Azure.Functions.Worker.Extensions.Kafka**
i dont see any relevant Ioptions implementation.
All the samples are suggesting to use host.json file like below

**"extensions": {
"kafka": {
"maxBatchSize": 3
}
}**

but with this approach we are configuring options for all the functions in the function app service. we need a way to configure them at function level. is there a way to achieve this?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.