Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 1.78 KB

Pipelines.md

File metadata and controls

57 lines (40 loc) · 1.78 KB

Pipelines

Contents

Creating Pipelines

Basic pipelines

Let's say you have the following line of code:

var result = long.Parse(age);

snippet source | anchor

You can refactor this to pipelines with the following

var inputPipe = new InputPipe<string>("age");
var parsePipe = inputPipe.ProcessFunction(long.Parse);
var collector = parsePipe.Collect();

inputPipe.Send("42");
var result = collector.SingleResult;

snippet source | anchor

These will produce the same results.

But Why?!?!

Despite the complexity add of this code, this pattern has some advantages in refactoring to async as well has advantages in monitoring. It also has advantages in testing and visualization. For example the pipeline can render itself as the following dot file (Graphviz)

GraphViz of Pipeline

Actions

Joins, ApplyTo, Concate

Output Generation Testing

See Testing Pipelines and Generating Output.