Search code examples
azure-service-fabricfailoverservice-fabric-stateless

Service architecture using service fabric


I am designing a stateless service which essentially processes a stream of information and then based on conditions sends emails. I want to host this in service fabric, with more than one active in case of failure, however how do I limit the email to be sent from only the "primary".

Is active/active only valid for stateful services which are partitioned? If the services have to be active/passive then how does the service know when it is now the active one?


Solution

  • There's no built-in mechanism for leader election (that you can use) inside SF. You could use a blob lease. The leader will be the one who acquires the lease, and needs to refresh it while it's 'alive'. If it crashes, it will lose the lease and another instance can get it. This does introduce an external dependency, lowering the overall availability % of your system.

    You could also create a Stateful service that does something similar.