如何为Azure Functions EventHub侦听器配置Receiver批处理大小? [英] How to configure Receiver batch size for Azure Functions EventHub listener?
问题描述
在最新的 Microsoft.Azure.WebJobs中. ServiceBus软件包,它使您能够从eventhub接收成批的消息.我想设置要批量接收的邮件数量.
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.
核心ServiceBus库允许您重载Receive()
函数并提供
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?
推荐答案
您可以通过host.json
中的eventHub
配置块在函数"中执行此操作,如
You can do this in Functions via the eventHub
configuration block in host.json
as described here. E.g.:
{
"eventHub": {
"maxBatchSize": 500,
"prefetchCount": 100
}
}
我们在创建EventProcessorHost
时将这些配置设置应用于EventProcessorOptions
(请参见
We apply those configuration settings to the EventProcessorOptions
when we create the EventProcessorHost
(see here).
这篇关于如何为Azure Functions EventHub侦听器配置Receiver批处理大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!