The project has a pre-defined state machine with the state diagram as below.
(FORK and JOIN are pseudo states and consequently there are no external transitions)
This project is as a PoC to have a distributed state machine using Redis as a backing store to store the StateMachineContext.
The Distributed State Machine offerred by Spring uses Zookeeper and is currently not production ready and this project is a stop-gap for it until such time ZK solution is deemed production ready.
Dependencies
- Redis running on Port 6379 in localhost. (This can be configured in redisson.yaml under resources folder)
Building from source
- Execute Gradle Build
- Execute the jar by using the command -
java -jar <jar name>
The jar is under build/libs folder.
The project uses Spring Shell and supports the following commands
- create-new string - Creates a new state machine with the provided name.
- get-status string - Gets the current status/state of the state machine.
- send-event statemachine event - Sends the event to the state machine indicated by the name.
- list-events - Lists all the events supported by the state machine.
- list-states - Lists all the states supported by the state machine.
- delete-sm statemachine - Delete the state machine
- help - Lists all the commands supported by the shell.