Class ConcurrentStatelessSubjectAsync<T>
- Namespace
- ReactiveUI.Extensions.Async.Subjects
- Assembly
- ReactiveUI.Extensions.dll
Represents a stateless asynchronous subject that forwards notifications to observers concurrently.
public sealed class ConcurrentStatelessSubjectAsync<T> : BaseStatelessSubjectAsync<T>, ISubjectAsync<T>, IObserverAsync<T>, IAsyncDisposable, IObservableAsync<T>
Type Parameters
TThe type of the elements processed by the subject.
- Inheritance
-
ConcurrentStatelessSubjectAsync<T>
- Implements
- Inherited Members
- Extension Methods
Remarks
This subject distributes notifications to all subscribed observers in parallel, allowing for improved throughput in scenarios where observer processing can occur independently. Use this type when observer notification order is not important and concurrent delivery is desired. Thread safety is ensured for concurrent observer notifications.
Constructors
ConcurrentStatelessSubjectAsync()
public ConcurrentStatelessSubjectAsync()
Methods
OnCompletedAsyncCore(IReadOnlyList<IObserverAsync<T>>, Result)
Notifies all observers that the asynchronous operation has completed, forwarding the specified 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 completion event. Cannot be null.
resultResultThe result to forward to each observer upon completion.
Returns
- ValueTask
A ValueTask that represents the asynchronous notification operation.
Remarks
Observers are notified concurrently. The method completes when all observers have been notified.
OnErrorResumeAsyncCore(IReadOnlyList<IObserverAsync<T>>, Exception, CancellationToken)
Notifies all specified observers of an error and resumes processing asynchronously.
protected override ValueTask OnErrorResumeAsyncCore(IReadOnlyList<IObserverAsync<T>> observers, Exception error, CancellationToken cancellationToken)
Parameters
observersIReadOnlyList<IObserverAsync<T>>The collection of observers to notify of the error. Cannot be null.
errorExceptionThe exception that occurred. 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 all observers in the collection with the specified 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 ValueTask that represents the asynchronous notification operation.
Remarks
Observers are notified concurrently. The operation completes when all observers have been notified or when the operation is canceled.