Right now I\'m implementing some polling logic with RxJava. I\'m supposed to poll an endpoint a number of times until it tells me to stop. Additionally, each response come
You could use the side effect operator doOnNext to update a delay variable and then use that in your repeatWhen
int pollDelay = 5000;
service.pollEndpoint()
.doOnNext(pollResponse -> pollDelay=pollResponse.getDelay())
.repeatWhen(observable -> observable.delay(pollDelay, TimeUnit.MILLISECONDS))
.takeUntil(Blah::shouldStopPolling);