Table of Contents

Class DataflowPipeline<TSource1, TSource2>

Namespace
DotnetKit.DataflowBuilder
Assembly
DotnetKit.DataflowBuilder.dll

Implements an executable multi-source dataflow pipeline that receives items from two distinct sources, joining them internally for downstream pipeline processing.

public class DataflowPipeline<TSource1, TSource2> : IPipeline<TSource1, TSource2>, IPipeline<Tuple<TSource1, TSource2>>

Type Parameters

TSource1

The type of elements accepted by the first source.

TSource2

The type of elements accepted by the second source.

Inheritance
DataflowPipeline<TSource1, TSource2>
Implements
IPipeline<TSource1, TSource2>
IPipeline<Tuple<TSource1, TSource2>>
Inherited Members
Extension Methods

Constructors

DataflowPipeline(JoinBlock<TSource1, TSource2>, IDataflowBlock)

Initializes a new instance of the DataflowPipeline<TSource1, TSource2> class.

public DataflowPipeline(JoinBlock<TSource1, TSource2> sourceBlock, IDataflowBlock destinationBlock)

Parameters

sourceBlock JoinBlock<TSource1, TSource2>

The join block joining input streams from both sources.

destinationBlock IDataflowBlock

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

Exceptions

ArgumentNullException

Thrown if sourceBlock or destinationBlock is null.

Methods

CompleteAsync()

Signals completion to both source targets and waits asynchronously for all pipeline stages to complete.

public Task CompleteAsync()

Returns

Task

A task representing the overall completion of the pipeline.

Send1Async(TSource1, CancellationToken)

Asynchronously sends a data item to the first source input.

public Task Send1Async(TSource1 dataItem, CancellationToken cancellationToken = default)

Parameters

dataItem TSource1

The item to send to the first source.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task

A task that completes when the item is accepted.

Send2Async(TSource2, CancellationToken)

Asynchronously sends a data item to the second source input.

public Task Send2Async(TSource2 dataItem, CancellationToken cancellationToken = default)

Parameters

dataItem TSource2

The item to send to the second source.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task

A task that completes when the item is accepted.

SendAsync(Tuple<TSource1, TSource2>, CancellationToken)

Sending combined tuples directly is not supported in a multi-source pipeline; use Send1Async(TSource1, CancellationToken) and Send2Async(TSource2, CancellationToken) instead.

public Task SendAsync(Tuple<TSource1, TSource2> dataItem, CancellationToken cancellationToken = default)

Parameters

dataItem Tuple<TSource1, TSource2>

The tuple payload.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task

Exceptions

NotSupportedException

Always thrown because inputs must be posted via Send1Async(TSource1, CancellationToken) and Send2Async(TSource2, CancellationToken).