Edit

Share via


IAsyncBatchObserver<T> Interface

Definition

This interface generalizes the IAsyncObserver interface to allow production and consumption of batches of items.

Note that this interface is implemented by item consumers and invoked (used) by item producers. This means that the consumer endpoint of a stream implements this interface.

public interface IAsyncBatchObserver<in T> : Orleans.Streams.IAsyncObserver<in T>
public interface IAsyncBatchObserver<T>
type IAsyncBatchObserver<'T> = interface
    interface IAsyncObserver<'T>
type IAsyncBatchObserver<'T> = interface
Public Interface IAsyncBatchObserver(Of In T)
Implements IAsyncObserver(Of In T)
Public Interface IAsyncBatchObserver(Of T)

Type Parameters

T

The type of object consumed by the observer.

This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
Derived
Implements

Methods

OnCompletedAsync()

Notifies the consumer that the stream was completed.

The Task returned from this method should be completed when the consumer is done processing the stream closure.

OnErrorAsync(Exception)

Notifies the consumer that the stream had an error.

The Task returned from this method should be completed when the consumer is done processing the stream closure.

OnNextAsync(IList<SequentialItem<T>>)

Passes the next batch of items to the consumer.

The Task returned from this method should be completed when the items' processing has been sufficiently processed by the consumer to meet any behavioral guarantees.

When the consumer is the (producer endpoint of) a stream, the Task is completed when the stream implementation has accepted responsibility for the items and is assured of meeting its delivery guarantees. For instance, a stream based on a durable queue would complete the Task when the items have been durably saved. A stream that provides best-effort at most once delivery would return a Task that is already complete.

When the producer is the (consumer endpoint of) a stream, the Task should be completed by the consumer code when it has accepted responsibility for the items. In particular, if the stream provider guarantees at-least-once delivery, then the items should not be considered delivered until the Task returned by the consumer has been completed.

OnNextAsync(T, StreamSequenceToken)

Passes the next item to the consumer.

The Task returned from this method should be completed when the item's processing has been sufficiently processed by the consumer to meet any behavioral guarantees.

When the consumer is the (producer endpoint of) a stream, the Task is completed when the stream implementation has accepted responsibility for the item and is assured of meeting its delivery guarantees. For instance, a stream based on a durable queue would complete the Task when the item has been durably saved. A stream that provides best-effort at most once delivery would return a Task that is already complete.

When the producer is the (consumer endpoint of) a stream, the Task should be completed by the consumer code when it has accepted responsibility for the item. In particular, if the stream provider guarantees at-least-once delivery, then the item should not be considered delivered until the Task returned by the consumer has been completed.

(Inherited from IAsyncObserver<T>)
OnNextBatchAsync(IEnumerable<T>, StreamSequenceToken)

Passes the next batch of items to the consumer.

The Task returned from this method should be completed when all items in the batch have been sufficiently processed by the consumer to meet any behavioral guarantees.

That is, the semantics of the returned Task is the same as for OnNextAsync, extended for all items in the batch.

Applies to