Steph Locke Steph Locke - 1 year ago 136
C# Question

How to configure Receiver batch size for Azure Functions EventHub listener?

In the latest Microsoft.Azure.WebJobs.ServiceBus package, it gives you the ability to receive batches of messages from eventhubs. I would like to set how many messages I want to receive in a batch.

The core ServiceBus library allows you to overload the

function and provide the batch size.

How does one do this in the initial config of an EventHubs receiver, or is something else required?

Answer Source

You can do this in Functions via the eventHub configuration block in host.json as described here. E.g.:

    "eventHub": {
        "maxBatchSize": 500,
        "prefetchCount": 100

We apply those configuration settings to the EventProcessorOptions when we create the EventProcessorHost (see here).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download