Table of Contents

Class PublishSubject<T>

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an expression builder that broadcasts the values from other observable sequences to multiple subscribers.

Marble diagram

PublishSubject passes to each subscribed observer only the values from the source sequence which were emitted after the time of subscription.

This fire-and-forget behavior means that any observers which subscribe late might lose one or more items emitted between the time that PublishSubject was created and the time that the observer subscribed to it. If you require guaranteed delivery of all values from the source sequence, you need to ensure that all observers subscribe immediately upon workflow initialization. If this is not possible, you should consider switching to an AsyncSubject if the sequence contains a single value, or a ReplaySubject if the sequence contains multiple values.

If the source sequence terminates with an error, PublishSubject will not emit any items to subsequent observers, but will pass along the terminating error.

[WorkflowElementIcon("PublishSubject")]
public class PublishSubject<T> : SubjectBuilder<T>, IExpressionBuilder, INamedElement

Type Parameters

T

The type of the elements processed by the subject.

Inheritance
PublishSubject<T>
Implements
Inherited Members
Extension Methods

Methods

CreateSubject()

Creates a shared subject that broadcasts the values from other observable sequences to multiple subscribers.

protected override ISubject<T> CreateSubject()

Returns

ISubject<T>

A new instance of ISubject<T>.