Table of Contents

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

TSource

The 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

sourceBlock ITargetBlock<TSource>

The entry target block that receives incoming data items.

destinationBlock IDataflowBlock

The final block in the pipeline chain whose completion signals overall pipeline termination.

Exceptions

ArgumentNullException

Thrown if sourceBlock or destinationBlock is 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

dataItem TSource

The item to send.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task

A task that completes when the item is accepted by the pipeline.