Description
When creating a python template with event hub you get the following:
import logging
import azure.functions as func
def main(event: func.EventHubEvent):
logging.info('Python EventHub trigger processed an event: %s',
event.get_body().decode('utf-8'))
{
"scriptFile": "__init__.py",
"bindings": [
{
"type": "eventHubTrigger",
"name": "event",
"direction": "in",
"eventHubName": "samples-workitems",
"connection": "",
"cardinality": "many",
"consumerGroup": "$Default"
}
]
}
which doesn't work for a number of reasons. One of which because cardinality
is set to many
it's sending in a list of event hub events. Even when doing that though, I get nasty JSON serialization errors. So had to change to this:
Azure/azure-functions-templates#913
Which even then isn't ideal because the function method declaration is:
def main(events: func.EventHubEvent):
Which isn't accurate (though it does run) because events
is actually a typing.List[func.EventHubEvent]
. But that doesn't work. So really there are two issues here. One is the template that I opened the PR for, but the other is the ability to be able to do a batch trigger typing (maybe what this issue should track).
// cc @anirudhgarg @kulkarnisonia16 would be a good item to prioritize for quality.