Class DataflowPipeline<TSource>
- Namespace
- DotnetKit.DataflowBuilder
- Assembly
- DotnetKit.DataflowBuilder.dll
Implements an executable single-source dataflow pipeline encapsulating an ingress target block and an egress destination block.
public class DataflowPipeline<TSource> : IPipeline<TSource>
Type Parameters
TSourceThe type of elements accepted by the pipeline entry.
- Inheritance
-
DataflowPipeline<TSource>
- Implements
-
IPipeline<TSource>
- Inherited Members
- Extension Methods
Constructors
DataflowPipeline(ITargetBlock<TSource>, IDataflowBlock)
Initializes a new instance of the DataflowPipeline<TSource> class.
public DataflowPipeline(ITargetBlock<TSource> sourceBlock, IDataflowBlock destinationBlock)
Parameters
sourceBlockITargetBlock<TSource>The entry target block that receives incoming data items.
destinationBlockIDataflowBlockThe final block in the pipeline chain whose completion signals overall pipeline termination.
Exceptions
- ArgumentNullException
Thrown if
sourceBlockordestinationBlockis null.
Methods
CompleteAsync()
Signals completion to the entry block and waits asynchronously until all pipeline stages have completed.
public Task CompleteAsync()
Returns
- Task
A task that represents completion of both the source and destination blocks.
SendAsync(TSource, CancellationToken)
Asynchronously sends a data item into the entry block of the pipeline.
public Task SendAsync(TSource dataItem, CancellationToken cancellationToken = default)
Parameters
dataItemTSourceThe item to send.
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task
A task that completes when the item is accepted by the pipeline.