If you want an example about how to use trigger metadata, you could refer to the below code or you could go to the github check the code. The below is my test code.
public class Eventhubtest {
/**
* This function will be invoked when an event is received from Event Hub.
*/
@FunctionName("Eventhubtest")
public void run(
@EventHubTrigger(name = "message", eventHubName = "myevent", connection = "EventHubConnection", cardinality = Cardinality.MANY)String message,
@BindingName("SystemPropertiesArray") SystemProperty[] systemPropertiesArray,
final ExecutionContext context) {
context.getLogger().info("Java Event Hub trigger function executed."+message);
context.getLogger().info("SystemProperties for message[0]: EnqueuedTimeUtc=" + systemPropertiesArray[0].EnqueuedTimeUtc +" Offset=" +systemPropertiesArray[0].Offset+" PartitionKey="+ systemPropertiesArray[0].PartitionKey);
}
public static class SystemProperty {
public String SequenceNumber;
public String Offset;
public String PartitionKey;
public String EnqueuedTimeUtc;
}
}
And here is the result. You could find the PartitionKey
is available in the pic.
