The Best Approach for a Pipeline Architecture in .NET | by Tobias Streng | Mar, 2022

Create a clear pipeline with minimal code requires

Photograph by Sigmund on Unsplash
Sketch of a Pipeline with Supply and Subscriber
  • Pipes could also be constructed with dependency injection.
  • Pipes ought to be configureable.
  • Pipes ought to take a stream of occasions as enter and output one other stream of occasions. The event-type might change hereby.


Throughout my analysis, I discovered many approaches of realizing a pipeline structure in .NET, nevertheless all of them have been too overcomplicated and never versatile sufficient, for my part. That’s why I made a decision to reinvent this structure fashion for .NET, making it far more clear and intuitive utilizing Reactive Extensions.

To get began, we’d like an interface, that we are able to use to declare a pipe. The interface ought to clarify what goes in and what goes out. I made a decision to name it IPipe<TIn, TOut>. This Pipe should include a way, that takes an IObservable<TIn> as enter and returns an IObservable<TOut>. We name it Deal with().

Instance Pipelines, which have a single supply
Instance implementation of a filter pipe
Implementation of IPipelineBuilder

With these modules, we’re in a position to decrease the code required, to create a clear pipeline. The pipeline can host limitless pipes and might be constructed in a sort protected method utilizing dependency-injection. Moreover, we’re in a position so as to add particular configuration choices, in order that we are able to host a number of pipelines, that characteristic the identical pipes with totally different configurations.

More Posts