A simple Finite State Machine example - implementation
$when::
fsm1.init (id)
. (dieselScope[="status"]="init")
$when::
fsm1.move
. (dieselScope[="status"]=((status + "-") + to))
$when::
fsm1.reset
. (dieselScope[="status"]="")
This works because the context is maintained for the duration of the story. This FSM would not maintain the state across stories, for instance... see below.
//$when fsm1.*(id) => ctx.persisted(kind="fsm1", id=id)
You need to log in to post a comment!