Search code examples
azure-webjobsazure-webjobssdk

JobHost.RunAndBlock not blocking


I have implemented a long running process as a WebJob which is triggered upon a queue message. My understanding is that JobHost.RunAndBlock() would only start executing once the current job has completed and returned. However, if my first process is still running when another queue message arrives, a second process starts executing and trashes the first process (which has some static data structures).


Solution

  • By default, queue messages are processed in parallel. The default degree of parallelism is 16.

    If you don't want parallel execution, you can set the JobHostConfiguration.Queues.BatchSize to 1, as described here.