Using the state machine could keep the Alpha transaction states tracing code simple . We could also use it to trace the command sending states.
Here are some feature requirement of the StateMachine:
- Statemachine should handle timeout dynamically
- Statemachine should support message(event) persistent
- Support to the states of transaction from outside
- Statemachine should have cluster support
Saga States:
SagaTransaction
→ LocalTransaction ...
→ SagaTransaction
→ LocalTransaction ...
Actor could send message to its parent to notify the state change of transactions, we just need to trace the "SagaStarted", "SagaAborted", "SagaEnded", "SagaComponsited","TxStarted","TxFailed","TxEnded", "TxComponsited".
We could also add "SagaSuspended" if we need that.
more details https://github.com/apache/servicecomb-pack/blob/SCB-1321/docs/fsm/design_fsm_zh.md