I'm converting Spring Boot (MVC) application to Reactive Programming (Spring Webflux)
For making external rest calls, I'm using WebClient.
List<String> targetUrls = Arrays.asList("one","two","three");
int iteration = 1;
for(String target:targetUrls){
// make a rest call here
// if 200 break the loop
// else loop continues
}
The rest call here returns a Mono.
Is there a way to iterate over the list of urls(here in this case) and break the loop based on some response
Tried flatMap on the Mono and based on response can make a rest call to another url --> This works in case we know before hand the number of urls