public class Guard implements ReactiveGuard<State, StateEvent> {
@Override
public Mono<Boolean> apply(final StateContext<State, StateEvent> stateStateEventStateContext) {
// return call to fucntion that return mono<Boolean> calling cassandra database;
}
}
And then in configuration of state machine, not exist guard function to add this guard
@Override
public void configure(
final StateMachineTransitionConfigurer<State, StateEvent> transitions)
throws Exception {
transitions
.withExternal()
.source(State.INIT)
.target(State.FINISH)
.event(StateEvent.INITIALIZE)
//There is no method to add the guard
.guardFunction(new Guard())
I have created this guard:
And then in configuration of state machine, not exist guard function to add this guard