17
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?

Alexander S.
  • 844
  • 1
  • 13
  • 29

1 Answers1

33

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(); 
daronyondem
  • 831
  • 7
  • 9