Executing a pipeline
Injecting and Executing a Pipeline
Inject the Pipeline
If you want to execute a pipeline from somewhere else, first, inject it into the constructor. This is demonstrated in the MyController
constructor, which takes an IPipeline<PipelineInputType, PipelineOutputType>
as a parameter:
Execute the Pipeline
When you're ready to execute the pipeline, create an instance of the input type and populate it with your desired parameters. Then, use the _myPipeline.Execute
method to process the input and get the output from the result.
Here's how you can do it:
response.EnsureSuccess()
throws a PipelineException
if any exceptions happen during the execution of the pipeline, otherwise, it will return the output (result) of the pipeline execution. The exceptions and output are also directly accessible using response.Errors
and response.Output
respectively.
Last updated