Service Fabric Concepts - Bhushan-Jagtap-2013/AzureServiceFabricExamples GitHub Wiki
Service fabric programming models
- Reliable services - Kind of console application.
- Stateless
- Stateful
- Reliable actors
- Guest executables - Port existing applications
- Containers
Service Lifecycle
Initialization
- Create service instance and then ask to create listeners and gets the list back. Call Open() on each lister and then call RunAsync() with Cancellation Token.
Termination
- Cancels the token then close all the listeners. Destroy the class instance.
Fail to honor cancellation will lead to service being reported as unhealthy and scaling issues.
Local Storage
- Provides replicated local storage.
- Need reference to IReliableStateManager
Generic questions
-
Where to find port for running service?
ServiceMenifest.xml -> Endpoint
Communication between service fabric services
- Never assume service location and request location from SF runtime
- Out of the box protocol options are: 1. WCF 2. HTTP 3. Service Remoting.
Advantages of service remoting for communication:
- Automatic service address resolution / discovery
- Establishing connection
- Retries
- Error handling
- Strong typed
- Fast
Remoting not suitable for following scenarios
- Custom binary protocols
- Unknown external consumers
- Protocol not supported by ASF.