Service Fabric Concepts - Bhushan-Jagtap-2013/AzureServiceFabricExamples GitHub Wiki

Service fabric programming models

  1. Reliable services - Kind of console application.
    • Stateless
    • Stateful
  2. Reliable actors
  3. Guest executables - Port existing applications
  4. 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:

  1. Automatic service address resolution / discovery
  2. Establishing connection
  3. Retries
  4. Error handling
  5. Strong typed
  6. Fast

Remoting not suitable for following scenarios

  1. Custom binary protocols
  2. Unknown external consumers
  3. Protocol not supported by ASF.