2
votes

My queue trigger works only when the azure queue is being populated with messages and when simultaneously the webjob is running.(in my local dev environment) But when i start the webjob (having the queue trigger) first , and then after a few seconds put new messages into the queue, the trigger doesn't detect them. Its like the trigger stops listening once there is no new messages. is this a normal behaviour for the trigger ? If not how do i resolve this issue ?

Main method :

 static void Main()
    {
        InitializeQueue();
        var config = new JobHostConfiguration();

        if (config.IsDevelopment)
        {
            config.UseDevelopmentSettings();
        }

        var host = new JobHost();
        // The following code ensures that the WebJob will be running continuously
        host.RunAndBlock();


    }

Function with queue trigger

 public static void ProcessQueueMessage([QueueTrigger("myqueue")] CloudQueueMessage message)
    {
        Debug.Write(message.AsString);     
    }
1

1 Answers

1
votes

For on-demand WebJobs, Azure has a configuration setting called WEBJOBS_IDLE_TIMEOUT that is denoted in seconds and defaults to two minutes.

If your on-demand WebJob isn’t triggered within the WEBJOBS_IDLE_TIMEOUT interval, Azure will kill your WebJob.

I recommend setting your Web App’s WEBJOBS_IDLE_TIMEOUT variable to a healthy number of seconds to prevent this from happening.

You can set this variable on the Web App’s Application Settings screen by adding it to the App Settings section of the Web App instance that is hosting your WebJob.