Reputation: 652
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) {
}
Upvotes: 3
Views: 2146
Reputation: 2646
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.
Upvotes: 10