在 EventHub 触发的 Azure 函数上设置轮询间隔

Set polling interval on EventHub triggered Azure function

当使用存储队列触发函数时,我们可以像 host.json [1]. But when using EventHub triggered functions, I cannot see any option to set the polling interval in hosts.json [2] 中那样用 maxPollingInterval 设置轮询间隔。问题:是否有为 EventHub 触发函数设置轮询间隔的选项?

参考资料:根据此评论 [3] in Azure-Functions Github repostiory, scale controller polls on 10 second interval. As per this link [4],逻辑应用似乎具有从 EventHub 进行轮询的轮询间隔。

目前无法为 Eventhub 触发的 azure 函数设置 maxPollingInterval

queue trigger的源代码中可以看到它定义了maxPollingIntervalthere,如下所示:

public TimeSpan MaxPollingInterval{xxx}

但是对于eventhub trigger,没有这样的定义。您可以在那里提交请求并要求他们添加此类功能。

顺便说一句,列出了 eventhub 触发功能的所有可用设置 here

基于对 EventHub 是 push-based 的理解,我在 错误的 印象下提出了这个查询,当设置为小于 maxPollingInterval 时,maxPollingInterval 10 秒,将导致死消费计划功能以该频率检查 EventHub 中的新消息。如果有人以同样错误的方式思考,就把它留在这里:)

即使对于存储队列触发器,maxPollingInterval 也只有在函数处于活动状态时才会产生结果。一旦函数停​​止(从内存中卸载),即使我们将 maxPollingInterval 设置为 1 秒,该函数也只会在秤控制器检查存储队列时被触发,这会按照自己的节奏发生,目前看来是10秒。以上仅适用于消费计划。在 App service/premium 计划中,该功能始终有效并且轮询按照 maxPollingInterval.

进行

活动的 Eventhub 触发函数正在等待 push-based 消息,因此不必进行轮询。因此像 maxPollingInterval 这样的设置对事件中心触发器没有意义。