Skip to content

IAsyncObservable<T> Methods

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.

SubscribeAsync(IAsyncObserver<T>)

abstract
public abstract Task<StreamSubscriptionHandle<T>> SubscribeAsync(IAsyncObserver<T> observer)
Subscribe a consumer to this observable.

Parameters

observerIAsyncObserver<T>
The asynchronous observer to subscribe.

Returns

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 explicitly unsubscribed.

SubscribeAsync(IAsyncObserver<T>, StreamSequenceToken?, string?)

abstract
public abstract Task<StreamSubscriptionHandle<T>> SubscribeAsync(IAsyncObserver<T> observer, StreamSequenceToken? token, string? filterData = null)
Subscribe a consumer to this observable.

Parameters

observerIAsyncObserver<T>
The asynchronous observer to subscribe.
tokenStreamSequenceToken?
The stream sequence to be used as an offset to start the subscription from.
filterDatastring?
Data object that will be passed in to the filter.

Returns

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 explicitly unsubscribed.