-
Notifications
You must be signed in to change notification settings - Fork 198
Description
Description
In the .NET 6 in-process Azure Functions model, we could access the PartitionId of the Event Hub partition using the PartitionContext parameter in the function signature:
public async Task Run([EventHubTrigger(...)] EventData[] events, ILogger log, PartitionContext partitionContext)
This was useful for logging, diagnostics, and partition-aware processing.
However, after migrating to the .NET 8 isolated worker model, there is no documented or supported way to access the PartitionId. Attempting to retrieve it from FunctionContext.BindingContext.BindingData returns null, and EventData only exposes PartitionKey, which is not the same.
var partitionContext = context.BindingContext.BindingData["PartitionContext"] as PartitionContext;//To convert to PartitionContext
Please provide a way to access the PartitionId in the isolated worker model, either:
By exposing it in BindingData under a known key, or
By extending EventData or providing a new context object similar to PartitionContext.
Describe alternatives you've considered
Logging from the host (not accessible in code)
Embedding partition info in the event payload (not always feasible)
This is a common use case for Event Hub consumers who need partition-level visibility. It would help maintain parity with the in-process model and improve observability in production systems.