I am using Akka FSM for handling state in my Actor. I want some actions to be performed every time a transition to a certain state occurs, no matter which state the transition was made from. After reading the docs, I felt certain that this could be resolved like this:
onTransition({
case (_, ToState) => performAction(stateData)
})
...
when(FromState){
case "changestate" => goto(ToState) using NewStateData
}
However, when the transition occurs, stateData is not yet updated to NewStateData.
What is the recommended way to perform actions on entering a certain state?