/// <summary> /// Ends the pipeline by executing the provided endpoint. Defaults to <see cref="HandlerPipelineEndpoint{T}" /> /// </summary> public static void Run <T>(this IPipelineBuilder <T> builder, Func <Message <T>, Task> action) { builder.Run(() => { return((message, cancellationToken, messageContext) => action(message)); }); }
public void ConfigurePipeline(IPipelineBuilder builder) { builder.Run(m => { MessagesReceived.Add(m); return(Task.CompletedTask); }); }
public override void ConfigurePipeline(IPipelineBuilder pipe) { pipe.Run(context => { var message = context.GetKafkaMessage <string, HttpRequest>(); return(Task.CompletedTask); }); }
public void ConfigurePipeline(IPipelineBuilder pipe) { // Middleware type example - terminal if the message is empty pipe.UseMiddleware <ExampleMiddleware>(); // Raw delegate examples below, but recommendation is Middleware classes // since they support dependency injection // wrap the next components with this bit of middleware: pipe.Use(WrappingExample); // Optional terminal example - passes along if a condition passes pipe.Use(FilteringExample); // Run adds terminal middleware - won't pass on the context any further pipe.Run(TerminalExample); // Any middleware here (after the Run) will never be invoked! }
/// <summary> /// Adds the MediatR pipeline endpoint to the end of the pipeline /// </summary> public static void RunMediatR <T>(this IPipelineBuilder <T> pipelineBuilder) { pipelineBuilder.Services.TryAddScoped <MediatRPipelineEndpoint <T> >(); pipelineBuilder.Run <MediatRPipelineEndpoint <T> >(); }