Feature Request : Add a utility to the state machine to allow consuming code to subscribe to any state change
See original GitHub issueCopied from my original request :
I would like to add an implementation in my state machine definition that would allow me to execute some code when ever the state of a saga instance changes. That is regardless of what the current state of the saga.
In the state machine definition it would be nice if we can define something like :
WhenEnter(State.Any,Callback ... or WhenEnterAnyState(Callback ... and something similar. That way we can define a common code to execute whenever the state of the saga changes.
It is worth mentioning here that, in the current version of MT(3.1.0.0) I was able to achieve something similar by creating my own version version of the “TransitionTo” extension method. like below (I hope it doesn’t make you cringe too much)
public static EventActivityBinder< TInstance, TData > TransitionToAndBlah< TInstance, TData >(
this EventActivityBinder< TInstance, TData > source,
State toState) where TInstance : MrCycle
{
return source.TransitionTo( toState ).Add( new ActionActivity< TInstance, TData >(MyCallBack);
}
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (3 by maintainers)

Top Related StackOverflow Question
So move beyond the current:
And add the ability to observe and react to any state change, taking the from/to state as an input parameter?
Perfect, looking forward to it, thanks.