Interface IAsyncObservable<T>
This interface generalizes the standard .NET IObserveable interface to allow asynchronous consumption of items. Asynchronous here means that the consumer can process items asynchronously and signal item completion to the producer by completing the returned Task.
Note that this interface is invoked (used) by item consumers and implemented by item producers. This means that the producer endpoint of a stream implements this interface.
Namespace: Orleans.Streams
Assembly: Orleans.Core.Abstractions.dll
Syntax
public interface IAsyncObservable<T>
Type Parameters
| Name | Description |
|---|---|
| T | The type of object produced by the observable. |
Methods
| Improve this Doc View SourceSubscribeAsync(IAsyncObserver<T>)
Subscribe a consumer to this observable.
Declaration
Task<StreamSubscriptionHandle<T>> SubscribeAsync(IAsyncObserver<T> observer)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncObserver<T> | observer | The asynchronous observer to subscribe. |
Returns
| Type | Description |
|---|---|
| Task<StreamSubscriptionHandle<T>> | A promise for a StreamSubscriptionHandle that represents the subscription. The consumer may unsubscribe by using this handle. The subscription remains active for as long as it is not explicitely unsubscribed. |
SubscribeAsync(IAsyncObserver<T>, StreamSequenceToken, StreamFilterPredicate, Object)
Subscribe a consumer to this observable.
Declaration
Task<StreamSubscriptionHandle<T>> SubscribeAsync(IAsyncObserver<T> observer, StreamSequenceToken token, StreamFilterPredicate filterFunc = null, object filterData = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncObserver<T> | observer | The asynchronous observer to subscribe. |
| StreamSequenceToken | token | The stream sequence to be used as an offset to start the subscription from. |
| StreamFilterPredicate | filterFunc | Filter to be applied for this subscription |
| System.Object | filterData | Data object that will be passed in to the filterFunc. This will usually contain any paramaters required by the filterFunc to make it's filtering decision. |
Returns
| Type | Description |
|---|---|
| Task<StreamSubscriptionHandle<T>> | A promise for a StreamSubscriptionHandle that represents the subscription. The consumer may unsubscribe by using this handle. The subscription remains active for as long as it is not explicitely unsubscribed. |