Table of Contents

Class RetryCount

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an operator that repeats an observable sequence the specified number of times or until it successfully terminates.

Marble diagram

RetryCount reacts to exceptional termination by disposing the previous subscription and resubscribing to the source sequence, up to the maximum number of times specified in the Count property. Value notifications received from all of the subscriptions are forwarded to the result sequence.

After the source sequence terminates exceptionally the specified maximum number of times, the result sequence will also terminate exceptionally. If any of the subscriptions completes successfully, the result sequence will also complete, and no further resubscriptions will be made.

Tip

The subscription side-effects (e.g. opening a file, initializing hardware connections) of all upstream operators will be repeated upon termination and resubscription to the source sequence. Sometimes this may be undesirable. For example logging side-effects introduced by Sink nodes may create extra files on each subscription. To shield operators from these effects, consider moving affected operators downstream from the resubscription operator, or moving the resubscription operator itself further upstream.

Caution

All resubscription operators should be applied with care to anonymous branch points in the workflow, since dangling branches operate independently from each other, and from the subscription to the source sequence. For more details, see Subjects.

public class RetryCount : Combinator
Inheritance
RetryCount
Inherited Members

Properties

Count

Gets or sets the number of times to repeat the sequence.

public int Count { get; set; }

Property Value

int

Methods

Process<TSource>(IObservable<TSource>)

Repeats the observable sequence the specified number of times or until it successfully terminates.

public override IObservable<TSource> Process<TSource>(IObservable<TSource> source)

Parameters

source IObservable<TSource>

The observable sequence to repeat until it successfully terminates.

Returns

IObservable<TSource>

The observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.

Type Parameters

TSource

The type of the elements in the source sequence.