I've been learning spring webflux and got stuck into this one.
I've made a request to REST API from Spring app using WebClient. I want to retry the request based on the response. lets say if the response has property status: 'not-ready'
, then I need to retry the same operation after a second.
I tried the following way, but not sure how to implement it
public Flux<Data> makeHttpRequest(int page) {
Flux<Data> data = webClient.get()
.uri("/api/users?page=" + page)
.retrieve()
.bodyToFlux(Data.class);
return data;
}
GET : /api/users returns the folowing response
ex: 1 {
status: 'ready',
data: [......]
}
ex: 2 {
status: 'not-ready',
data: null
}
Any help would be appreciated.