Skip to content

Event Hub batch needs improvement #589

Closed
Azure/azure-functions-python-library
#31
@jeffhollan

Description

@jeffhollan

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.

Metadata

Metadata

Assignees

Labels

P1[P1] items : Ship blockingquality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions