Azure WebJob does not trigger queue

Question!

I'v created Azure WebJob. Publish it as continious job.

Here is main function:

static void Main()
    {

        var config = new JobHostConfiguration();
        config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(2);
        config.Queues.MaxDequeueCount = 3;
        var host = new JobHost(config);
        host.RunAndBlock();
    }

Here is function that triggers queue:

   public static class Functions{
   public static void    ProcessQueueMessage([QueueTrigger("queue")]QueueMessage queueMessage, TextWriter log)
    {
        //du staff
    }
  }

Than I send message to queue called "queue", but job not triggered. Also in dashboard I can see, that job has started and executes.

And one moment: when I debug it on local machine all fine: function called when message appeared in queue.

Why it is not triggered by message in queue on Azure?



Answers

I suspect that the web job's storage configuration might not pointing to the correct Storage account. Please check if you are writing to the queue of the storage account which is configured with your web job.

Also one more point to keep in mind is if the web job is hosted in a free plan it is possible that the web job is not running.

Some important points from Azure Documentation

Notes

  1. Web apps in Free mode can time out after 20 minutes if there are no requests to the scm (deployment) site and the web app's portal is not open in Azure. Requests to the actual site will not reset this.
  2. Code for a continuous job needs to be written to run in an endless loop. Continuous jobs run continuously only when the web app is up.
  3. Basic and Standard modes offer the Always On feature which, when enabled, prevents web apps from becoming idle.
By : Sandesh


This video can help you solving your question :)
By: admin