Reputation: 182
1) I am processing a particular event from the transition, how Do I get the info about next event? 2) If I need to stop the transition from one state to another during the transition action, how Do I do that?
Upvotes: 2
Views: 1473
Reputation: 181
1) I'm guessing your processing code runs in a transition's action.
You can get from the provided StateContext
the source state, the target state, and the event that caused the transition.
You can't possibly get the next event, because it wasn't sent yet.
2) I don't think that's possible.
If the transition action might fail and it means that in this scenario you should go to an altogether different state - then you should redesign your statemachine to run this code from somewhere different than the transition action.
For example from the state's action, and send a different event based on success/failure.
Upvotes: 2