Closed gustavodaquino closed 2 years ago
If you configure statemachine as you've attached one, it has never transited to S3
state from S1
state even you send S3
event, different S3
state, to transit to S3
state.
There are no triggers, events or timer, on you statemachine configuration to transit from S1
state to S3
state. If you want to validate or control when event is not accepted, you may implement eventNotAccepted
on StateMachineListener
.
...
/**
* Notified when event was not accepted.
*
* @param event the event
*/
void eventNotAccepted(Message<E> event);
...
Thanks, @se0kjun , but I'm wondering if there is another way to validate this incorrect event.
When I send stateMachine.sendEvent("S3")
, I would like to my stateMachine
object alerts my application in the same thread execution, where I could return a boolean false, or throw an exception.
In this function you reference, an exception throw is handled only by state machine, is it correct?
Good afternoon!
On the example below, suppose that I start a new instance of a SM, and now it is on S1 state. If now I send a S3 event, how can I validate this wrong attempt of transition?
I searched in docs, in some questions posted in SO, and none of the approaches sounds good for me, because all of them involves write some arbitrary data on context and treat accordingly to take some decision, throw an exception, et cetera.
There is a clean way on framework to deal with this situation?