Table of Contents

Class PublishSubject

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an expression builder that broadcasts the values of an observable sequence to multiple subscribers using a shared subject.

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 : SubjectBuilder, IExpressionBuilder, INamedElement
Inheritance
PublishSubject
Implements
Inherited Members
Extension Methods

Methods

BuildSubject(Expression)

When overridden in a derived class, returns the expression that creates the shared subject.

protected override Expression BuildSubject(Expression expression)

Parameters

expression Expression

The expression representing the observable input sequence.

Returns

Expression

The Expression that creates the shared subject.