FSM: fire onTransition() hooks for certain same-state transitions
Currently, the FSM implementation does not fire onTransition() hooks when transitioning to the state the FSM is currently in.
It seems like there are use-cases for which a same-state transition is meaningful, and not merely indicative of a "no op" circumstance. For example, if one were implementing an FSM to simulate the handling of the regular expression /(a)*b/, the transition from state "a" back to itself is not a "no op" and it consumes one message to do so (the letter "a").
Furthermore it seems like Akka FSM's API would not need to be modified, as the user could make this distinction by choosing between goto(state) and stay() -- the first implying a transition and the second implying none.
I developed a FizzBuzz example that depends on a same-state transition, and works around the limitation using two identical states that simply bounce between each other. While workable it looks quite clumsy. https://gist.github.com/JavadocMD/9859519 It would be nice if Akka could support this without the need for ugly work-arounds.
Thank you.
It seems like there are use-cases for which a same-state transition is meaningful, and not merely indicative of a "no op" circumstance. For example, if one were implementing an FSM to simulate the handling of the regular expression /(a)*b/, the transition from state "a" back to itself is not a "no op" and it consumes one message to do so (the letter "a").
Furthermore it seems like Akka FSM's API would not need to be modified, as the user could make this distinction by choosing between goto(state) and stay() -- the first implying a transition and the second implying none.
I developed a FizzBuzz example that depends on a same-state transition, and works around the limitation using two identical states that simply bounce between each other. While workable it looks quite clumsy. https://gist.github.com/JavadocMD/9859519 It would be nice if Akka could support this without the need for ugly work-arounds.
Thank you.
Leave a comment
on 2014-03-31 23:05 *
By tylercoles
Summary changed from FMS: fire onTransition() hooks for certain same-state transitions to FSM: fire onTransition() hooks for certain same-state transitions
on 2014-04-10 01:10 *
By Konrad Malawski
Estimate changed from None to Small
Sum of child estimates changed from 0.0 to 1.0