gpt4 book ai didi

.net - WebJob QueueTrigger 如何触发、轮询或事件?

转载 作者:行者123 更新时间:2023-12-02 09:43:02 25 4
gpt4 key购买 nike

public static void ProcessMessage([QueueTrigger("queue")] string message, TextWriter log)
{
//processing message
}

该方法将如何被触发。

WebJob 主机是否只是轮询存储队列。或者存储队列引发该主机订阅的新消息事件?

最佳答案

此链接有您的答案;

http://azure.microsoft.com/en-us/documentation/articles/websites-dotnet-webjobs-sdk-storage-queues-how-to/

Polling algorithm

The SDK implements a random exponential back-off algorithm to reduce the effect of idle-queue polling on storage transaction costs. When a message is found, the SDK waits two seconds and then checks for another message; when no message is found it waits about four seconds before trying again. After subsequent failed attempts to get a queue message, the wait time continues to increase until it reaches the maximum wait time, which defaults to one minute. The maximum wait time is configurable.

这也有帮助;

JobHostConfiguration config = new JobHostConfiguration();       
config.Queues.MaxPollingInterval = TimeSpan.FromMinutes(1);
JobHost host = new JobHost(config);
host.RunAndBlock();

关于.net - WebJob QueueTrigger 如何触发、轮询或事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27819092/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com