Class SerialSubjectAsync<T>
- Namespace
- ReactiveUI.Extensions.Async.Subjects
- Assembly
- ReactiveUI.Extensions.dll
Represents an asynchronous subject that notifies observers in a serial manner, ensuring each observer is notified one at a time.
public sealed class SerialSubjectAsync<T> : BaseSubjectAsync<T>, ISubjectAsync<T>, IObserverAsync<T>, IAsyncDisposable, IObservableAsync<T>
Type Parameters
TThe type of the elements processed and observed by the subject.
- Inheritance
-
SerialSubjectAsync<T>
- Implements
- Inherited Members
- Extension Methods
Remarks
SerialSubjectAsync{T} is designed for scenarios where observers must be notified sequentially rather than concurrently. This can be useful when observer operations are not thread-safe or when order of notification is important. Notifications to observers are performed asynchronously and in sequence.
Constructors
SerialSubjectAsync()
public SerialSubjectAsync()
Methods
OnCompletedAsyncCore(IReadOnlyList<IObserverAsync<T>>, Result)
Asynchronously notifies all observers that the observation has completed with the specified result.
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 completion event. Cannot be null.
resultResultThe result to provide to each observer upon completion.
Returns
- ValueTask
A ValueTask that represents the asynchronous notification operation.
OnErrorResumeAsyncCore(IReadOnlyList<IObserverAsync<T>>, Exception, CancellationToken)
Notifies each observer in the collection to resume 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.