How to add a reactive guard to a spring state machine external configuration?

114 Views Asked by At

I'm working in a reactive java project with spring state machine version 3.2.1. I have created a reactive guard like this:

public ReactiveGuard<BookingState, BookingEvent> bookingIdGuard(){
  return context -> //Function that does some checks and return a Mono<Boolean>
}

Then I try to add it to transitions external configuration (similarly as I did with ssm 2.x), however, I cannot find any method to do it:

@Override
public void configure(StateMachineTransitionConfigurer<BookingState, BookingEvent> transitions) throws Exception {
transitions
 .withExternal()
 .source(BookingState.FIRST)
 .target(BookingState.SECOND)
 .event(BookingEvent.APPROVE)
 //Cannot find a method to add the reactive guard

How could I add the reactive guard to the configuration?

0

There are 0 best solutions below