Class AsyncReactiveSubjectBase<TInput, TOutput>
Base class for subjects.
Inheritance
Implements
Inherited Members
Namespace: Reaqtor
Assembly: Reaqtor.Local.Core.dll
Syntax
public abstract class AsyncReactiveSubjectBase<TInput, TOutput> : AsyncDisposableBase, IAsyncReactiveSubject<TInput, TOutput>, IAsyncReactiveObserver<TInput>, IAsyncReactiveObservable<TOutput>, IAsyncDisposable
Type Parameters
Name | Description |
---|---|
TInput | Type of the data received by the subject. |
TOutput | Type of the data produced by the subject. |
Constructors
AsyncReactiveSubjectBase()
Declaration
protected AsyncReactiveSubjectBase()
Methods
OnCompletedAsync(CancellationToken)
Reports completion of the subject.
Declaration
public Task OnCompletedAsync(CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | token | Token to observe for cancellation of the request. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Task to await the acknowledgement of the submission of the event, or an exception. |
Remarks
If observer calls are not awaited in a sequential manner, the processing order of events in the subject is undefined.
OnCompletedAsyncCore(CancellationToken)
Reports completion of the subject.
Declaration
protected abstract Task OnCompletedAsyncCore(CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | token | Token to observe for cancellation of the request. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Task to await the acknowledgement of the submission of the event, or an exception. |
Remarks
If observer calls are not awaited in a sequential manner, the processing order of events in the subject is undefined.
OnErrorAsync(Exception, CancellationToken)
Reports an error to the subject.
Declaration
public Task OnErrorAsync(Exception error, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | error | Error to report on the subject. |
System.Threading.CancellationToken | token | Token to observe for cancellation of the request. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Task to await the acknowledgement of the submission of the event, or an exception. |
Remarks
If observer calls are not awaited in a sequential manner, the processing order of events in the subject is undefined.
OnErrorAsyncCore(Exception, CancellationToken)
Reports an error to the subject.
Declaration
protected abstract Task OnErrorAsyncCore(Exception error, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | error | Error to report on the subject. |
System.Threading.CancellationToken | token | Token to observe for cancellation of the request. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Task to await the acknowledgement of the submission of the event, or an exception. |
Remarks
If observer calls are not awaited in a sequential manner, the processing order of events in the subject is undefined.
OnNextAsync(TInput, CancellationToken)
Sends a value to the subject.
Declaration
public Task OnNextAsync(TInput value, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
TInput | value | Object to send to the subject. |
System.Threading.CancellationToken | token | Token to observe for cancellation of the request. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Task to await the acknowledgement of the submission of the event, or an exception. |
Remarks
If observer calls are not awaited in a sequential manner, the processing order of events in the subject is undefined.
OnNextAsyncCore(TInput, CancellationToken)
Sends a value to the subject.
Declaration
protected abstract Task OnNextAsyncCore(TInput value, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
TInput | value | Object to send to the subject. |
System.Threading.CancellationToken | token | Token to observe for cancellation of the request. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Task to await the acknowledgement of the submission of the event, or an exception. |
Remarks
If observer calls are not awaited in a sequential manner, the processing order of events in the subject is undefined.
SubscribeAsync(IAsyncReactiveObserver<TOutput>, Uri, Object, CancellationToken)
Subscribes to the subject using the given observer.
Declaration
public Task<IAsyncReactiveSubscription> SubscribeAsync(IAsyncReactiveObserver<TOutput> observer, Uri subscriptionUri, object state = null, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
IAsyncReactiveObserver<TOutput> | observer | Observer to send the subject's data to. |
System.Uri | subscriptionUri | URI to identify the subscription. |
System.Object | state | Additional metadata to associate with the artifact. Implementations can interpret this value, or ignore it. |
System.Threading.CancellationToken | token | Token to observe for cancellation of the request. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IAsyncReactiveSubscription> | Task returning a subscription object that can be used to cancel the subscription, or an exception if the submission was unsuccessful. |
SubscribeAsyncCore(IAsyncReactiveObserver<TOutput>, Uri, Object, CancellationToken)
Subscribes to the subject using the given observer.
Declaration
protected abstract Task<IAsyncReactiveSubscription> SubscribeAsyncCore(IAsyncReactiveObserver<TOutput> observer, Uri subscriptionUri, object state, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IAsyncReactiveObserver<TOutput> | observer | Observer to send the subject's data to. |
System.Uri | subscriptionUri | URI to identify the subscription. |
System.Object | state | Additional metadata to associate with the artifact. Implementations can interpret this value, or ignore it. |
System.Threading.CancellationToken | token | Token to observe for cancellation of the request. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IAsyncReactiveSubscription> | Task returning a subscription object that can be used to cancel the subscription, or an exception if the submission was unsuccessful. |