Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does WebJob QueueTrigger trigger, polling or event?

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

How exactly this method will be triggered.

Is WebJob host just poling the Storage Queue. Or Storage Queue raising new message event, that host subscribed to?

like image 389
Alexander S. Avatar asked Jan 07 '15 12:01

Alexander S.


1 Answers

This link has your answer;

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.

This can help too;

JobHostConfiguration config = new JobHostConfiguration();       
config.Queues.MaxPollingInterval = TimeSpan.FromMinutes(1);        
JobHost host = new JobHost(config);
host.RunAndBlock(); 
like image 135
daronyondem Avatar answered Oct 31 '22 20:10

daronyondem