Class SerialStatelessSubjectAsync<T>
- Namespace
- ReactiveUI.Extensions.Async.Subjects
- Assembly
- ReactiveUI.Extensions.dll
Represents a stateless asynchronous subject that notifies observers of events in a serial, sequential manner.
public sealed class SerialStatelessSubjectAsync<T> : BaseStatelessSubjectAsync<T>, ISubjectAsync<T>, IObserverAsync<T>, IAsyncDisposable, IObservableAsync<T>
Type Parameters
TThe type of the elements processed and observed by the subject.
- Inheritance
-
SerialStatelessSubjectAsync<T>
- Implements
- Inherited Members
- Extension Methods
Remarks
Observers are notified one at a time in the order they are registered. Each observer receives the event only after the previous observer has completed processing. This class is suitable for scenarios where event delivery order and sequential processing are required. Thread safety and ordering are managed internally.
Constructors
SerialStatelessSubjectAsync()
public SerialStatelessSubjectAsync()
Methods
OnCompletedAsyncCore(IReadOnlyList<IObserverAsync<T>>, Result)
Notifies all specified observers that the asynchronous operation has completed, passing the provided result to each observer.
protected override ValueTask OnCompletedAsyncCore(IReadOnlyList<IObserverAsync<T>> observers, Result result)
Parameters
observersIReadOnlyList<IObserverAsync<T>>A read-only list of observers to be notified of the operation's completion. Cannot be null.
resultResultThe result to provide to each observer upon completion.
Returns
- ValueTask
A task that represents the asynchronous notification operation.
Remarks
The method awaits the completion of each observer's notification in sequence. If any observer's notification fails, the exception will propagate and subsequent observers will not be notified.
OnErrorResumeAsyncCore(IReadOnlyList<IObserverAsync<T>>, Exception, CancellationToken)
Notifies each observer in the collection to resume processing after an error has occurred, using asynchronous operations.
protected override ValueTask OnErrorResumeAsyncCore(IReadOnlyList<IObserverAsync<T>> observers, Exception error, CancellationToken cancellationToken)
Parameters
observersIReadOnlyList<IObserverAsync<T>>A read-only list of observers to be notified to resume after the error. Cannot be null.
errorExceptionThe exception that caused the error. Cannot be null.
cancellationTokenCancellationTokenA 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 each observer in the specified collection with the provided value.
protected override ValueTask OnNextAsyncCore(IReadOnlyList<IObserverAsync<T>> observers, T value, CancellationToken cancellationToken)
Parameters
observersIReadOnlyList<IObserverAsync<T>>A read-only list of observers to be notified. Cannot be null.
valueTThe value to send to each observer.
cancellationTokenCancellationTokenA cancellation token that can be used to cancel the notification operation.
Returns
- ValueTask
A task that represents the asynchronous notification operation.