I have a scenario where I need to call search api to get a list of particular item based on the search radius on map. The requirement is to show at least five results. In my case I have two Apis (two observables). First I need to call getExpandedSearchRadius() to get radius and perform second call, doSearch() with radius as parameter. Suppose the doSearchApi Call returns only 2 results I need to repeat the both api calls till I get the minimum result of 5. On each repeat getExpandedSearchRadius need to call to return a new expanded radius and perform doSearch with new radius.
Here the problem is each time the repeat() is called
getExpandedSearchRadius Api is not executing, only the second call is executing with the initial radius, resulting in same searchResponse. below is a sample that I tried.
getExpandedSearchRadius().flatMap{ radius -> doSearch(radius)}
.repeat()
.takeUntil(searchResponse.getItems().size >=5)
.map(anotherClass::displayOnMap)
getExpandedSearchRadiusimplemented. Did you by any chance usejust? - akarnokdgetExpandedSearchRadius. - akarnokd