I'm new to Spring State Machine. I have used a StateMachineListener for my state machine. How can i access to StateContext in eventNotAccepted method.
@Override
public void eventNotAccepted(Message<String> event) {
}
You need to use StateMachineListener.stateContext(StateContext<S, E>) and listen all StateContext changes. From there check StateContext.getStage() when it matches Stage.EVENT_NOT_ACCEPTED.
Originally when that listener interface were added we didn't have context and later when people wanted access to it we didn't want to break backward compatibility, thus that new method were added.
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