Skip to content

AsyncBatchObservableExtensions Methods

Extension methods for Orleans.Streams.IAsyncBatchObservable.

SubscribeAsync(IAsyncBatchObservable<T>, Func<IList<SequentialItem<T>>, Task>)

staticextension
View source
public static Task<StreamSubscriptionHandle<T>> SubscribeAsync<T>(this IAsyncBatchObservable<T> obs, Func<IList<SequentialItem<T>>, Task> onNextAsync)
Subscribe a consumer to this observable using delegates. This method is a helper for the IAsyncBatchObservable.SubscribeAsync allowing the subscribing class to inline the handler methods instead of requiring an instance of IAsyncBatchObserver.

Parameters

obsIAsyncBatchObservable<T>
The Observable object.
onNextAsyncFunc<IList<SequentialItem<T>>, Task>
Delegate that is called for IAsyncBatchObserver.OnNextAsync.

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(IAsyncBatchObservable<T>, Func<IList<SequentialItem<T>>, Task>, Func<Exception, Task>)

staticextension
View source
public static Task<StreamSubscriptionHandle<T>> SubscribeAsync<T>(this IAsyncBatchObservable<T> obs, Func<IList<SequentialItem<T>>, Task> onNextAsync, Func<Exception, Task> onErrorAsync)
Subscribe a consumer to this observable using delegates. This method is a helper for the IAsyncBatchObservable.SubscribeAsync allowing the subscribing class to inline the handler methods instead of requiring an instance of IAsyncBatchObserver.

Parameters

obsIAsyncBatchObservable<T>
The Observable object.
onNextAsyncFunc<IList<SequentialItem<T>>, Task>
Delegate that is called for IAsyncBatchObserver.OnNextAsync.
onErrorAsyncFunc<Exception, Task>
Delegate that is called for IAsyncBatchObserver.OnErrorAsync.

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(IAsyncBatchObservable<T>, Func<IList<SequentialItem<T>>, Task>, Func<Exception, Task>, Func<Task>)

staticextension
View source
public static Task<StreamSubscriptionHandle<T>> SubscribeAsync<T>(this IAsyncBatchObservable<T> obs, Func<IList<SequentialItem<T>>, Task> onNextAsync, Func<Exception, Task> onErrorAsync, Func<Task> onCompletedAsync)
Subscribe a consumer to this observable using delegates. This method is a helper for the IAsyncBatchObservable.SubscribeAsync allowing the subscribing class to inline the handler methods instead of requiring an instance of IAsyncBatchObserver.

Parameters

obsIAsyncBatchObservable<T>
The Observable object.
onNextAsyncFunc<IList<SequentialItem<T>>, Task>
Delegate that is called for IAsyncBatchObserver.OnNextAsync.
onErrorAsyncFunc<Exception, Task>
Delegate that is called for IAsyncBatchObserver.OnErrorAsync.
onCompletedAsyncFunc<Task>
Delegate that is called for IAsyncBatchObserver.OnCompletedAsync.

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(IAsyncBatchObservable<T>, Func<IList<SequentialItem<T>>, Task>, Func<Task>)

staticextension
View source
public static Task<StreamSubscriptionHandle<T>> SubscribeAsync<T>(this IAsyncBatchObservable<T> obs, Func<IList<SequentialItem<T>>, Task> onNextAsync, Func<Task> onCompletedAsync)
Subscribe a consumer to this observable using delegates. This method is a helper for the IAsyncBatchObservable.SubscribeAsync allowing the subscribing class to inline the handler methods instead of requiring an instance of IAsyncBatchObserver.

Parameters

obsIAsyncBatchObservable<T>
The Observable object.
onNextAsyncFunc<IList<SequentialItem<T>>, Task>
Delegate that is called for IAsyncBatchObserver.OnNextAsync.
onCompletedAsyncFunc<Task>
Delegate that is called for IAsyncBatchObserver.OnCompletedAsync.

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(IAsyncBatchObservable<T>, IAsyncBatchObserver<T>, StreamSubscriptionStartPosition)

staticextension
View source
public static Task<StreamSubscriptionHandle<T>> SubscribeAsync<T>(this IAsyncBatchObservable<T> obs, IAsyncBatchObserver<T> observer, StreamSubscriptionStartPosition startPosition)
Subscribe a consumer to this batch observable using the specified initial position.

Parameters

obsIAsyncBatchObservable<T>
The observable.
observerIAsyncBatchObserver<T>
The asynchronous batch observer to subscribe.
startPositionStreamSubscriptionStartPosition
The initial subscription position.

Returns

A promise for a Orleans.Streams.StreamSubscriptionHandle that represents the subscription.