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?
Thanks for bringing this to my attention, that was indeed an oversight, which I fixed immediately (see the ticket). Unfortunately there is not much you can do (apart from merging in the tiny patch yourself) until 1.3 is out, which should be next week; if you are particularly impatient, I would appreciate if you could try out RC2 with the fix which will be released this week.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With