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

How does WebJob QueueTrigger trigger, polling or event?

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

该方法将如何被触发。

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

这个link有你的答案;

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();