Azure WebJob does not trigger queue

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?

Upvotes: 1

Views: 2207

Answers (2)

Youngjae
Youngjae

Reputation: 25050

Followed by @Sandesh, I recommend anyone check app setting firstly.

Both AzureWebJobsDashboard and AzureWebJobsStorage should be placed in app settings field inside of Azure WebSites Configure tab as image shown below. The two keys (AzureWebJobsStorage, AzureWebJobsDashboard) are hardcoded so do NOT change key names.

Also, it is not enough to put in App.config file. Please check the values are placed at the App Settings of Azure Configure tab accordingly.

enter image description here

Upvotes: 2

Sandesh
Sandesh

Reputation: 3004

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.

Upvotes: 0

Related Questions