NetPipe 0.9.2.1

This library has the concept of a set of pipes joint by connectors where pipes are just code that do a single task and connectors coordinate the execution.

Install-Package NetPipe -Version 0.9.2.1
dotnet add package NetPipe --version 0.9.2.1
<PackageReference Include="NetPipe" Version="0.9.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetPipe --version 0.9.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Simple pipeline

This library has the concept of a set of pipes joint by connectors where pipes are just code that do a single task and connectors coordinate the execution. Each pipe receives a load which is just a dictionary with the state of the current task, each pipe can read/write information from that dictionary.

Simple example:

Task 1 -> Task 2 -> Task 3
var testLoad = new Dictionary<string, object>();

var runner = new PipeLine()
    .Pipe(load => load["Task 1"] = true)
    .Connect()
    .Pipe(load => load["Task 2"] = true)
    .Connect()
    .Pipe(load => load["Task 3"] = true)
    .Finish();

runner.Run(testLoad);

Now the load dictionary should look something like this:

| Key | Value |
|-----|-------|
| Task 1 | true |
| Task 2 | true |
| Task 3 | true |

Basic condition example:

            -> Task 2 -
          |            |
Task 1 -> o -> Task 3 -o -> Task 5
          |            |
            -> Task 4 -
var pipeLine = new PipeLine()
    .Pipe(load => load["Task 1"] = true)
    .ConnectWhen((pipes, load) =>
    {
        var chosenPath = load["ChosenPipe"].ToString();
        return pipes.OfType<NamedPipe>().First(p => p.Name == chosenPath);
    })
    .Pipe("pipe2", load => load["Task 2"] = true) // Named pipe
    .Pipe("pipe3", load => load["Task 3"] = true) // Named pipe
    .Pipe("pipe4", load => load["Task 4"] = true) // Named pipe
    .Join()
    .Pipe(load => load["Task 5"] = true)
    .Finish();

// Runs Task 1 -> Task 2 -> Task 5
var path125 = new Dictionary<string, object> { ["ChosenPipe"] = "Task 2" };
pipeLine.Run(path125);

// Runs Task 1 -> Task 3 -> Task 5
var path135 = new Dictionary<string, object> { ["ChosenPipe"] = "Task 3" };
pipeLine.Run(path135);

// Runs Task 1 -> Task 4 -> Task 5
var path145 = new Dictionary<string, object> { ["ChosenPipe"] = "Task 4" };
pipeLine.Run(path145);

Simple pipeline

This library has the concept of a set of pipes joint by connectors where pipes are just code that do a single task and connectors coordinate the execution. Each pipe receives a load which is just a dictionary with the state of the current task, each pipe can read/write information from that dictionary.

Simple example:

Task 1 -> Task 2 -> Task 3
var testLoad = new Dictionary<string, object>();

var runner = new PipeLine()
    .Pipe(load => load["Task 1"] = true)
    .Connect()
    .Pipe(load => load["Task 2"] = true)
    .Connect()
    .Pipe(load => load["Task 3"] = true)
    .Finish();

runner.Run(testLoad);

Now the load dictionary should look something like this:

| Key | Value |
|-----|-------|
| Task 1 | true |
| Task 2 | true |
| Task 3 | true |

Basic condition example:

            -> Task 2 -
          |            |
Task 1 -> o -> Task 3 -o -> Task 5
          |            |
            -> Task 4 -
var pipeLine = new PipeLine()
    .Pipe(load => load["Task 1"] = true)
    .ConnectWhen((pipes, load) =>
    {
        var chosenPath = load["ChosenPipe"].ToString();
        return pipes.OfType<NamedPipe>().First(p => p.Name == chosenPath);
    })
    .Pipe("pipe2", load => load["Task 2"] = true) // Named pipe
    .Pipe("pipe3", load => load["Task 3"] = true) // Named pipe
    .Pipe("pipe4", load => load["Task 4"] = true) // Named pipe
    .Join()
    .Pipe(load => load["Task 5"] = true)
    .Finish();

// Runs Task 1 -> Task 2 -> Task 5
var path125 = new Dictionary<string, object> { ["ChosenPipe"] = "Task 2" };
pipeLine.Run(path125);

// Runs Task 1 -> Task 3 -> Task 5
var path135 = new Dictionary<string, object> { ["ChosenPipe"] = "Task 3" };
pipeLine.Run(path135);

// Runs Task 1 -> Task 4 -> Task 5
var path145 = new Dictionary<string, object> { ["ChosenPipe"] = "Task 4" };
pipeLine.Run(path145);

Release Notes

- Added Skip capability to the BeforePipeEvent.
- Fixed 'first connector won't run bug'
- Added helper methods to PipeLineRunner to register events.
- Fixed 'first connector won't trigger bug'

  • .NETCoreApp 2.0

    • No dependencies.

Version History

Version Downloads Last updated
0.9.2.1 219 4/8/2018
0.9.2 256 1/29/2018
0.9.1 250 1/25/2018
0.9.0 221 1/23/2018