Hyperbee.Pipeline
1.2.0
dotnet add package Hyperbee.Pipeline --version 1.2.0
NuGet\Install-Package Hyperbee.Pipeline -Version 1.2.0
<PackageReference Include="Hyperbee.Pipeline" Version="1.2.0" />
paket add Hyperbee.Pipeline --version 1.2.0
#r "nuget: Hyperbee.Pipeline, 1.2.0"
// Install Hyperbee.Pipeline as a Cake Addin #addin nuget:?package=Hyperbee.Pipeline&version=1.2.0 // Install Hyperbee.Pipeline as a Cake Tool #tool nuget:?package=Hyperbee.Pipeline&version=1.2.0
Hyperbee Pipeline
Hyperbee.Pipeline
allows you to construct asynchronous fluent pipelines in .NET. A pipeline, in this context, refers to a
sequence of data processing elements arranged in series, where the output of one element serves as the input for the subsequent
element.
Hyperbee pipelines are composable, reusable, and easy to test. They are designed to be used in a variety of scenarios, such as data processing, message handling, and workflow automation.
Some key features are:
- Middleware
- Hooks
- Wraps
- Conditional flows
- Loops
- Parallel processing
- Dependency injection
- Early returns and cancellation
- Child pipelines
Why Use Pipelines
Pipelines provide a structured approach to managing complex processes, promoting SOLID principles, including Inversion of Control (IoC) and Separation of Concerns (SoC). They enable composability, making it easier to build, test, and maintain your code. By extending the benefits of middleware and request-response pipelines throughout your application, you achieve greater modularity, scalability, and flexibility. This is especially critical in domains such as healthcare, compliance auditing, identity and roles, and high-security environments where clear boundaries and responsibilities are essential. Hyperbee.Pipeline ensures that the advantages of pipelines and middleware are not abandoned at the controller implementation, addressing a common gap in many frameworks. By using a functional approach, Hyperbee.Pipeline ensures that your pipelines are not only robust and maintainable but also highly adaptable to changing requirements.
Getting Started
To get started with Hyperbee.Json, refer to the documentation for detailed instructions and examples.
Install via NuGet:
dotnet add package Hyperbee.Pipeline
Building and Executing Pipelines
Pipelines are built using PipelineFactory
. Once built, a pipeline is just an async function that takes a PipelineContext
and
an optional input value as parameters, and returns a result.
var command = PipelineFactory
.Start<string>()
.Pipe( ( ctx, arg ) => $"hello {arg}" )
.Build();
var result = await command( new PipelineContext(), "pipeline" );
Assert.AreEqual( "hello pipeline", result );
Dependency Injection
Sometimes Pipelines and Pipeline middleware need access to specific container services. This can be
accomplished by registering services with the PipelineContextFactory
. This can be done through
DI configuration, or manually through the PipelineContextFactoryProvider
if you are not using DI.
Pipelines manage dependencies with a specialized container. This allows the implementor to control
the services that are exposed through the pipeline. If you want to expose all application
services then you can call AddPipeline
and pass includeAllServices: true
.
Register pipelines with DI and provide Pipeline dependencies using the application container.
services.AddPipeline( includeAllServices: true );
Register Pipelines with DI and provide Pipeline dependencies using a specialized container.
services.AddPipeline( (factoryServices, rootProvider) =>
{
factoryServices.AddTransient<IThing>()
factoryServices.ProxyService<IPrincipalProvider>( rootProvider ); // pull from root container
} );
Pipeline of Pipelines
The PipelineFactory
library allows you to use pipelines together. Since pipelines are just functions, they can be used
as input to other pipelines. This allows you to create complex data processing flows by reusing and chaining together
multiple pipelines.
Here's an example of how to use pipelines together:
var pipeline2 = PipelineFactory
.Start<string>()
.Pipe( ( ctx, arg ) => $"{arg} again!" )
.Build();
var pipeline1 = PipelineFactory
.Start<string>()
.Pipe( ( ctx, arg ) => $"hello {arg}" )
.PipeAsync( pipeline2 )
.Build();
var result = await pipeline1( new PipelineContext(), "you" );
Assert.AreEqual( "hello you again!", result );
Conditional Flow and Advanced Features
The PipelineFactory
library provides a variety of builders that allow you to customize the behavior of your pipelines.
These methods provide powerful functionality for manipulating data as it passes through the pipeline.
- Functions
- Procedures
- Conditional Flow
- Iterators
- Reduce
- Parallel execution
Credits
Hyperbee.Pipeline is built upon the great work of several open-source projects. Special thanks to:
- Just The Docs for the documentation theme.
Contributing
We welcome contributions! Please see our Contributing Guide for more details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Logging (>= 8.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Hyperbee.Pipeline:
Package | Downloads |
---|---|
Hyperbee.Pipeline.Caching
Caching for Hyperbee.Pipelines async pipelines |
|
Hyperbee.Pipeline.Auth
Auth for Hyperbee.Pipelines async pipelines |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.0 | 121 | 8/9/2024 |
1.1.6 | 81 | 5/3/2024 |
1.1.6-develop.240702125702 | 55 | 7/2/2024 |
1.1.6-develop.240506164152 | 67 | 5/6/2024 |
1.1.6-develop.240501134935 | 40 | 5/1/2024 |
1.1.5 | 126 | 4/4/2024 |
1.1.5-develop.240501134801 | 41 | 5/1/2024 |
1.1.5-develop.240404193630 | 65 | 4/4/2024 |
1.1.5-develop.240404174526 | 59 | 4/4/2024 |
1.1.4 | 114 | 4/3/2024 |
1.1.4-develop.240403195311 | 51 | 4/3/2024 |
1.1.4-develop.240403194830 | 54 | 4/3/2024 |
1.1.3 | 103 | 4/3/2024 |
1.1.3-develop.240403161108 | 55 | 4/3/2024 |
1.1.3-develop.240403155732 | 54 | 4/3/2024 |
1.1.2 | 107 | 4/2/2024 |
1.1.2-develop.240403142422 | 54 | 4/3/2024 |
1.1.2-develop.240403141849 | 51 | 4/3/2024 |
1.1.1 | 101 | 4/2/2024 |
1.1.1-develop.240402201732 | 52 | 4/2/2024 |
1.1.0 | 120 | 4/1/2024 |
1.0.0 | 177 | 4/1/2024 |