I created a Spring webflux webclient.I want to repeat the same operation based on my response. For ex: if the data is still empty, I want to retry to get the data. How to do that ?
Flux<Data> data = webClient.get()
.uri("/api/users?page=" + page)
.retrieve()
.flatMap(o -> {
o.subscribe(data -> {
if(data == null) {
// WHAT TO DO HERE, TO REPEAT THE SAME CALL ?
o.retry();
}
});
return o;
})
.bodyToFlux(Data.class);