简体   繁体   English

如何配置 singleton - 队列触发 Azure Function

[英]How to configure for singleton - Queue Triggered Azure Function

I'd like an azure function that's triggered from an Azure storage account queue to run as a singleton.我喜欢azure ZC1C1C425268E683851AB5074C174F174C174F14F14F14F14F14F174F14Z是从Z3A580F14220367F1F1F1F1556ATAS ASER INCOR触发的触发的,

The function app is in-process and net6: function 应用程序正在进行中,并且 net6:

    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>

My function currently looks as follows:我的 function 目前看起来如下:

[FunctionName(nameof(QueueTrigger))]    
public async Task QueueBatch([QueueTrigger("TriggerSurvey")] TriggerMsg triggerMsg)

Anyone know how to configure so that only one instance of the function will ever poll the queue?任何人都知道如何配置,以便只有一个 function 实例将轮询队列?

The batch size and the threshold for getting a new batch are configurable in the host.json file.批量大小和获取新批次的阈值可在 host.json 文件中配置。 If you want to minimize parallel execution for queue-triggered functions in a function app, you can set the batch size to 1. This setting eliminates concurrency only so long as your function app runs on a single virtual machine (VM).如果您想最小化 function 应用程序中队列触发函数的并行执行,您可以将批处理大小设置为 1。只要您的 function 应用程序在单个虚拟机 (VM) 上运行,此设置就会消除并发性。

host.json > extensions > queues > batchSize

https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue-trigger?tabs=csharp https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue-trigger?tabs=csharp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Visual Studio中编写的Azure队列触发功能不监听队列 - Azure queue triggered function written in visual studio not listening queue 服务总线队列触发 Azure Function 的“唤醒”时间 - "Wake up" time of Azure Function triggered by Service Bus Queue Azure触发的队列无法删除 - Azure triggered queue failing to delete 如何执行Azure Queue触发的大量持久函数? - How to execute a lot of durable functions triggered by Azure Queue? 如何在计时器触发的函数上强制执行单例行为? - how to enforce singleton behavior on a timer-triggered function? 如何在 Azure Function 中配置 OpenApiRequestBody? - How to configure OpenApiRequestBody in Azure Function? 如何更新webhook触发的azure函数中的记录? - How to update the record in an azure function triggered by a webhook? 获取 azure function 中的队列名称或主题+订阅者名称(Azure 服务总线触发函数) - Get Queue name or Topic+Subscriber name in azure function (Azure Service Bus triggered functions) 如何在没有队列触发器的情况下从 Azure function 中的 Azure 队列读取 - How to read from an Azure queue in an Azure function, without a Queue Trigger Azure Function Singleton 带令牌 - Azure Function Singleton with Token
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM