Table of Contents

Class RetryWhenOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

Extension methods implementing the retryWhen operator.

public static class RetryWhenOperator
Inheritance
System.Object
RetryWhenOperator

Remarks

A more general, config-driven version of Retry<T>(Observable<T>, int, TimeSpan?, IScheduler?, bool)'s fixed count/delay: instead of a retry budget, notifier receives an observable of every error source raises and returns an observable whose emissions each trigger a resubscription. If the notifier observable completes, the whole sequence completes (without ever forwarding the error that triggered the notifier); if it errors, that error becomes the final error forwarded downstream.

Methods

RetryWhen<T, TNotification>(Observable<T>, Func<Observable<Exception>, Observable<TNotification>>)

Resubscribes to source whenever it errors, but only once the observable returned by notifier (given an observable of every error so far) emits a value in response to that error. If the notifier observable completes instead of emitting, the sequence completes normally. If it errors, that error is forwarded downstream via OnError instead of the original.

public static Observable<T> RetryWhen<T, TNotification>(this Observable<T> source, Func<Observable<Exception>, Observable<TNotification>> notifier)

Parameters

source Observable<T>

The source sequence to retry on error.

notifier Func<Observable<Exception>, Observable<TNotification>>

A function, called with an observable of every error source has raised so far, that returns an observable whose emissions each trigger a resubscription to source.

Returns

Observable<T>

An observable that mirrors source, retrying on error as directed by notifier.

Type Parameters

T

The type of values emitted by source.

TNotification

The element type of the observable returned by notifier; only its emissions/termination matter, not the values themselves.

Remarks

notifier is called once per subscription, lazily, the first time source errors — not eagerly at subscribe time. If notifier itself throws, that exception is forwarded via OnError. The value type of the notifier's output observable is never inspected — only whether and when it emits, errors, or completes.