Table of Contents

Class ConcurrentStatelessReplayLatestSubjectAsync<T>

Namespace
ReactiveUI.Extensions.Async.Subjects
Assembly
ReactiveUI.Extensions.dll

Represents an asynchronous subject that replays the latest value to new observers and forwards notifications to all observers concurrently without maintaining internal state.

public sealed class ConcurrentStatelessReplayLatestSubjectAsync<T> : BaseStatelessReplayLastSubjectAsync<T>, ISubjectAsync<T>, IObserverAsync<T>, IAsyncDisposable, IObservableAsync<T>

Type Parameters

T

The type of the elements processed by the subject.

Inheritance
ConcurrentStatelessReplayLatestSubjectAsync<T>
Implements
Inherited Members
Extension Methods

Remarks

This subject is designed for concurrent scenarios where notifications to observers should be delivered in parallel. It does not buffer or store a sequence of values, but only replays the most recent value (if any) to new subscribers. Thread safety is ensured for concurrent observer notifications. If a notification operation is canceled, not all observers may receive the notification.

Constructors

ConcurrentStatelessReplayLatestSubjectAsync(Optional<T>)

Represents an asynchronous subject that replays the latest value to new observers and forwards notifications to all observers concurrently without maintaining internal state.

public ConcurrentStatelessReplayLatestSubjectAsync(Optional<T> startValue)

Parameters

startValue Optional<T>

An optional initial value to be replayed to new observers. If not specified, no value is replayed until the first value is published.

Remarks

This subject is designed for concurrent scenarios where notifications to observers should be delivered in parallel. It does not buffer or store a sequence of values, but only replays the most recent value (if any) to new subscribers. Thread safety is ensured for concurrent observer notifications. If a notification operation is canceled, not all observers may receive the notification.

Methods

OnCompletedAsyncCore(IReadOnlyList<IObserverAsync<T>>, Result)

Asynchronously notifies all observers that the sequence has completed, forwarding the completion signal to each observer.

protected override ValueTask OnCompletedAsyncCore(IReadOnlyList<IObserverAsync<T>> observers, Result result)

Parameters

observers IReadOnlyList<IObserverAsync<T>>

A read-only list of observers to be notified of the completion event. Cannot be null.

result Result

The result information to be passed to each observer upon completion.

Returns

ValueTask

A ValueTask that represents the asynchronous notification operation. The task completes when all observers have been notified.

Remarks

Observers are notified concurrently. If any observer throws an exception during notification, the exception may be propagated according to the implementation of the forwarding mechanism.

OnErrorResumeAsyncCore(IReadOnlyList<IObserverAsync<T>>, Exception, CancellationToken)

Asynchronously notifies all observers of an error and resumes processing, if possible.

protected override ValueTask OnErrorResumeAsyncCore(IReadOnlyList<IObserverAsync<T>> observers, Exception error, CancellationToken cancellationToken)

Parameters

observers IReadOnlyList<IObserverAsync<T>>

A read-only list of observers to be notified of the error.

error Exception

The exception that occurred and is to be forwarded to the observers. Cannot be null.

cancellationToken CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

ValueTask

A ValueTask that represents the asynchronous notification operation.

OnNextAsyncCore(IReadOnlyList<IObserverAsync<T>>, T, CancellationToken)

Asynchronously notifies all observers in the collection with the specified value.

protected override ValueTask OnNextAsyncCore(IReadOnlyList<IObserverAsync<T>> observers, T value, CancellationToken cancellationToken)

Parameters

observers IReadOnlyList<IObserverAsync<T>>

A read-only list of observers to be notified. Cannot be null.

value T

The value to send to each observer.

cancellationToken CancellationToken

A cancellation token that can be used to cancel the notification operation.

Returns

ValueTask

A ValueTask that represents the asynchronous notification operation.

Remarks

Notifications are forwarded to all observers concurrently. If the operation is canceled, not all observers may receive the notification.