问题描述
现在在 Azure 队列触发器函数应用程序中,队列触发器在第一个队列消息处理完成之前开始执行或从队列中选取另一条消息,我要求只有在第一个过程完成时才选取该消息
我的host.json:
{
"version": "2.0","logging": {
"applicationInsights": {
"samplingExcludedTypes": "Request","samplingSettings": {
"isEnabled": true
}
}
},"extensions": {
"queues": {
"maxPollingInterval": "00:1:00","visibilityTimeout": "00:05:00","batchSize": 1,"maxDequeueCount": 5,"newBatchThreshold": 0
}
}
}
解决方法
也许你可以在 host.json
中这样设置:
{
"version":"2.0","extensions": {
"queues": {
"batchSize": 1,"newBatchThreshold": 0
}
}
}
并且您还需要在 App Setting
中设置 WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT = 1 以防止函数扩展实例。
==========更新==================
您可以在 Function app
中将 Azure portal
的实例设置为 1。
如果这不起作用,您可以使用 consumption plan
并按照之前推荐的设置来实现您的目标。