Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import io.reactivex.Observable;
public class RetryWhenDelay {
@Test
public void test() throws Exception {
Observable<Integer> call = Observable.create(emitter -> {
emitter.onNext(1);
emitter.onError(new Throwable("Error"));
});
call
.retryWhen(throwableObservable -> throwableObservable.delay(1, TimeUnit.SECONDS))
.subscribe(integer -> System.out.println(integer), throwable -> System.out.println(throwable.getMessage()));
Thread.sleep(10000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.