I have a time triggered Azure Function deployed in multiple regions and I want to have singleton behavior across them. For example, if the regions are west US and central Europe, I want only one of them to run each time. Can this be achieved?
As the documentation says, TimeTrigger uses the Singleton attribute implicitly to ensure only one instance of a function is run per host, so that aspect is covered.
In order to have the same behavior in all regions, I tried using Singleton with the following parameters:
[Singleton(Account = "myAccount", Mode = SingletonMode.Listener)]
I tested it locally by copying my C# solution and running both projects. The following error was shown:
The listener for function 'MyFunction' was unable to start.
Microsoft.Azure.WebJobs.Host.Storage: Must replace singleton lease manager to
support multiple accounts.
I did not find information about the Account property more than from the metadata of the Singleton class, that says Gets the name of the Azure Storage account that the blob lease should be created in. I don't know how the function knows how to connect to the Storage and where to configure the connection.