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 Receive()
function and provide the batch size.
How does one do this in the initial config of an EventHubs receiver, or is something else required?
Steph,
The
MaxBatchSize
can be configured through EventProcessorOptions, you can pass it as a parameter when creating a new EventHubConfiguration.As you can notice in the source code of EventHubConfiguration.cs if no
EventProcessorOptions
is specified, theMaxBatchSize
is set to1000
instead of10
by default.You can do this in Functions via the
eventHub
configuration block inhost.json
as described here. E.g.:We apply those configuration settings to the
EventProcessorOptions
when we create theEventProcessorHost
(see here).