I'm new to the whole Spring reactive webflux. My problem is pretty simple. In my addActions() I am trying to get a Mono by calling getCurrentVal(). This works fine. But I need to get the value of that and update a property (submission.stateVal). Then pass call customService.addActions() which returns Mono. Can this be done without using block()?
@Autowired
private CustomService customService;
public Mono<CustomResponse> addActions(String id, String Jwt, Submission submission) {
Mono<String> updatedStateVal = getCurrentStateVal(tpJwt, id);
// submission.setStateVal(updatedStateVal);
// return customService.addActions(id, jwt, submission);
}
private Mono<String> getCurrentVal(String tpJwt, String id) {
return customService.findById(id, tpJwt)
.map(r -> r.getStateVal());
}
return getCurrentStateVal(tpJwt, id)
.flatMap(s -> {
submission.setStateVal(s);
return customService.addActions(id, tpJwt, submission);
});