Leader election
In this instance, we are using the WhenStartedAsLeader method from a wonderful third-party extension entitled Topshelf.Leader, which we installed via our NuGet package mechanism, the same as we have done before. This provides us with something known in computer science as leader election. Leader election is the process by which a single process can be designated as the leader among several distributed processes. In the beginning, no process knows who the leader is. They must agree on which one will assume this role. That is exactly the functionality the Topshelf.Leader framework provides.
We now use the WhenStartedAsLeader() extension method, which contains its own version of the WhenStarted() method, one with cancellation-token ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access