Class PipelineExtensions
- Namespace
- DotnetKit.DataflowBuilder
- Assembly
- DotnetKit.DataflowBuilder.dll
Provides extension methods for ingesting data streams into IPipeline<TSource> instances.
public static class PipelineExtensions
- Inheritance
-
PipelineExtensions
- Inherited Members
Methods
SendAllAsync<TSource>(IPipeline<TSource>, IAsyncEnumerable<TSource>, bool, CancellationToken)
Asynchronously streams all elements from an IAsyncEnumerable<T> into the pipeline.
public static Task SendAllAsync<TSource>(this IPipeline<TSource> pipeline, IAsyncEnumerable<TSource> source, bool completeAfterSend = false, CancellationToken cancellationToken = default)
Parameters
pipelineIPipeline<TSource>The target pipeline.
sourceIAsyncEnumerable<TSource>The asynchronous stream of elements to send.
completeAfterSendboolWhether to automatically call CompleteAsync() after all items are dispatched.
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task
A task that completes when all elements have been sent (and completed, if
completeAfterSendis true).
Type Parameters
TSourceThe type of elements accepted by the pipeline.
Exceptions
- ArgumentNullException
Thrown if
pipelineorsourceis null.
SendAllAsync<TSource>(IPipeline<TSource>, IEnumerable<TSource>, bool, CancellationToken)
Asynchronously sends all elements from an IEnumerable<T> into the pipeline.
public static Task SendAllAsync<TSource>(this IPipeline<TSource> pipeline, IEnumerable<TSource> source, bool completeAfterSend = false, CancellationToken cancellationToken = default)
Parameters
pipelineIPipeline<TSource>The target pipeline.
sourceIEnumerable<TSource>The sequence of elements to send.
completeAfterSendboolWhether to automatically call CompleteAsync() after all items are dispatched.
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task
A task that completes when all elements have been sent (and completed, if
completeAfterSendis true).
Type Parameters
TSourceThe type of elements accepted by the pipeline.
Exceptions
- ArgumentNullException
Thrown if
pipelineorsourceis null.
SendFromChannelAsync<TSource>(IPipeline<TSource>, ChannelReader<TSource>, bool, CancellationToken)
Asynchronously reads all elements from a ChannelReader<T> and sends them into the pipeline until the channel is completed.
public static Task SendFromChannelAsync<TSource>(this IPipeline<TSource> pipeline, ChannelReader<TSource> channelReader, bool completeAfterSend = true, CancellationToken cancellationToken = default)
Parameters
pipelineIPipeline<TSource>The target pipeline.
channelReaderChannelReader<TSource>The channel reader producing items.
completeAfterSendboolWhether to automatically complete the pipeline once the channel completes. Defaults to true.
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task
A task that completes when all channel items have been forwarded to the pipeline.
Type Parameters
TSourceThe type of elements accepted by the pipeline.
Exceptions
- ArgumentNullException
Thrown if
pipelineorchannelReaderis null.