Create a Webjob singleton using multiple deployments using web applications in Azure

With Azure WebApps, I know that I can make WebJob single by adding "is_singleton": trueWebJob to the file settings.job, and this works fine if I have, for example, 3 instances in one WebApp deployment.

However - how can I publish two WebApps (use case, two different regions) and make WebJob run as singleton and in only one of the deployments.


An example of the desired behavior:

Sydney Deployment

  • My Singleton Webjob (Running)
  • My other WebJobs that handle the queue (Running)

Deployment in Singapore

  • My Singleton Webjob (not working or maybe not even deployed?)
  • My other WebJobs that handle the queue (Running)

, azure - , , visual studio, ?

Visual Studio 2015.

+4
2

, , - . , - .

:

  • webjob , .
  • Azure blob , webjob, , , ( - , ).
+2

Singleton, , , ;

SDK WebJobs SingletonAttribute. SingletonAttribute , , .

[Singleton]
public static async Task ProcessImage([BlobTrigger("images")] Stream image)
{
     // Process the image
}

, Singleton :

/ Singleton, .

[Singleton("{Region}")]
public static async Task ProcessWorkItem([QueueTrigger("workitems")] WorkItem workItem)
{
     // Process the work item
}
+4

Source: https://habr.com/ru/post/1606691/


All Articles