Skip to content

EventHub output binding: set partitionKey for output event #654

Open
@tartieret

Description

@tartieret

Context

The EventHub SDK allows to specify the partitionKey for a batch of events, as shown here:

batch = hub_client.create_batch(partition_key=mykey)
batch.add(EventData(json.dumps({ ... })))
hub_client.send_batch(batch)

Issue

The documentation for Azure Functions shows how to use a function return value to send an event to EventHub, using the following configuration and function:

{
    "type": "eventHub",
    "name": "$return",
    "eventHubName": "myeventhub",
    "connection": "MyEventHubSendAppSetting",
    "direction": "out"
}
import logging
import azure.functions as func

def main(timer: func.TimerRequest) -> str:
    return 'Hello world'

How can we modify the example above to set the partitionKey on the output message ?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions