Azure / Azure/azure-functions-java-library

Unable to access PartitionContext or get PartitionId when using EventHubTrigger

Open
#138 3 comments 3 reactions 0 assignees View on GitHub
area:java-functions
Dominant language
Java
Stars
45
Forks
49
PR merge metrics
No merged PRs in 30d

Description

While using EventHubTrigger, unable to access PartitionContext. Also I am not finding any other way to access the partition Id.
Please find below the code. On trying to get PartitionContext using @BindingName, partitionContext object is null.

```
@FunctionName("EhbExample")
@StorageAccount("AzureWebJobsStorage")
public void run(
@EventHubTrigger(name = "msg", cardinality = Cardinality.MANY, eventHubName = "%SourceEHName%", connection = "SourceEHConnString", consumerGroup = "%SourceEHConsumerGrp%") List eventData,
final ExecutionContext context, @BindingName("SystemPropertiesArray") SystemProperty[] systemProperties,
@BindingName("PartitionContext") PartitionContext partitionContext ) {
Logger log = context.getLogger();
log.info("Triggered Function App");

log.info("Partition Id: " + partitionContext.getPartitionId());

for (int i=0;i

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.