Example to show how to use Finite State Machine (FSM) in Azure Service Fabric Actor Programming model. Learn more about the example on my blog at http://www.jamessturtevant.com/posts/Creating-a-Finite-State-Machine-Distributed-Workflow-with-Service-Fabric-Reliable-Actors/.
Note: This sample has modified
ActorGarbageCollectionSettingsin the start up
program.csfile of the actor service to test the deactivation and rehydration of the actors state for the FSM. You most likely will not want to modify to modify the default settings in your solution so do not copy them.
- Make sure you have the Service Fabric SDK and Visual Studio installed
- Clone this repository:
git clone https://github.com/jsturtevant/azure-service-fabric-actor-fsm.git
- Open the solution file in Visual Studio
F5to build and run the solution on your local Service Fabric cluster (the application is set up for refresh on single node local cluster)
- That deployed the FSM Actor service, now deploy the sample consumer by right clicking on the
ActorExpirementproject and selecting
Debug->Start new instance
You will see output from a console application as it spins through creating a couple actors, pushing them through the FSM states, waiting for them to be deactivated and then push them through the FSM after they have been re-hydrated.