NickDev.SimplePipeline
1.0.0
dotnet add package NickDev.SimplePipeline --version 1.0.0
NuGet\Install-Package NickDev.SimplePipeline -Version 1.0.0
<PackageReference Include="NickDev.SimplePipeline" Version="1.0.0" />
<PackageVersion Include="NickDev.SimplePipeline" Version="1.0.0" />
<PackageReference Include="NickDev.SimplePipeline" />
paket add NickDev.SimplePipeline --version 1.0.0
#r "nuget: NickDev.SimplePipeline, 1.0.0"
#:package NickDev.SimplePipeline@1.0.0
#addin nuget:?package=NickDev.SimplePipeline&version=1.0.0
#tool nuget:?package=NickDev.SimplePipeline&version=1.0.0
Basics
The pipeline model is composed of queues and steps. It starts with an "In" queue and finishes with an "Out" queue, in between is what you decide to do.
The simplest example would be :
- In - step - Out
Queues
Defining a queue is the easiest thing:
PipelineQueue("in")
without the queue size (defaults to 1000 items) or
PipelineQueue("in", 10)
with queue size
Steps
Two types of steps exist
ActionStep
: has an input queue and an output queue, this step does something to the item providedRouterStep
: has an input queue and several output queues, this step routes the item to a queue based on condition
Defining a step depends on it's type:
PipelineAction(Func<IPipelineItem, IPipelineItem> function, string inputQName, string outputQName, [int parallelismDegree = 1])
The function of the action step returns the modified item which is placed automatically on the output queue
PipelineRouter(Func<IPipelineItem, string> function, string inputQName, string[] outputQNames, [int parallelismDegree ) 1])
The function of the router step returns the name of the output queue upon which to place the item
Pipeline Item
In order to process anything and everything, a special item interface is used. This interface must be implemented to allow items to be placed in the pipeline. A simple implementation would be :
public class item : IPipelineItem
{
public ItemStatus Status { get; set; } = ItemStatus.New;
public ItemTreatment Treatment { get; set; } = new ItemTreatment();
public object Content { get; set; }
public Type ContentType { get { return typeof(int); } set => throw new NotImplementedException(); }
public TaskCompletionSource<IPipelineItem> TaskCompletionSource { get; set; } = new TaskCompletionSource<IPipelineItem>();
}
The content property holds the data you need to process
Pipeline
The pipeline itself is generated using a factory:
IAwaitablePipeline<IPipelineItem> PipelineFactory.CreatePipeline(string inQueue, string outQueue, IEnumerable<IPipelineStep> steps, IEnumerable<PipelineQueue> queues, Func<IPipelineItem, bool> logger)
The work starts when the first item is placed in the in queue
Task<IPipelineItem> IAwaitablePipeline<IPipelineItem>.Execute(IPipelineItem input)
Output
The output queue must be read in order for the pipeline to work, filling the queue will block the entire system. Example
Task.Run(() => {
foreach (var o in outP.GetConsumingEnumerable())
{
Console.WriteLine(string.Concat(o.Treatment.Message));
}
});
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 536 | 6/18/2020 |
Initial version