public async Task OnNextAsync(T item, StreamSequenceToken token) { if (token != null && !IsRewindable) { throw new ArgumentNullException("token", "Passing a non-null token to a non-rewindable IAsyncBatchObserver."); } if (isDisposed) { throw new ObjectDisposedException(string.Format("{0}-{1}", GetType(), "OnNextAsync")); } if (!connectedToRendezvous) { if (!this.optimizeForImmutableData) { // In order to avoid potential concurrency errors, synchronously copy the input before yielding the // thread. DeliverItem below must also be take care to avoid yielding before copying for non-immutable objects. item = (T)this.serializationManager.DeepCopy(item); } await ConnectToRendezvous(); } await myExtension.DeliverItem(stream.InternalStreamId, item); }
public async Task OnNextAsync(T item, StreamSequenceToken token) { if (token != null && !IsRewindable) { throw new ArgumentNullException("token", "Passing a non-null token to a non-rewindable IAsyncBatchObserver."); } if (isDisposed) { throw new ObjectDisposedException(string.Format("{0}-{1}", GetType(), "OnNextAsync")); } if (!connectedToRendezvous) { await ConnectToRendezvous(); } await myExtension.DeliverItem(stream.StreamId, item); }