Reputation: 239
I've a below API that returns a Mono. Since the result can be huge, server does some work and returns partial result. To get all the results I need to get token from Result and set it on Request object and send the new request untill Result.token
is null
.
Mono<Result> get(Request request)
This is how it can be done in synchronous API that returns only Result.
Request request = new Request();
do {
Result result = get(request); //send to remote server
//process result
for(String value: result.getData()) {
//process value
}
request.token = result.getToken(); //set token on request
} while(request.getToken() != null)
How can I achieve the same using Mono<Result>
? Result has main data in List and some additional metadata.
Upvotes: 1
Views: 52