The Command Pipeline is a robust implementation of the Mediator pattern, providing a centralized way to handle business logic while supporting complex cross-cutting concerns through a flexible middleware system.
CommandsBus and how it builds the execution onion.[Order], [SharedBehavior], and [Span] to control the pipeline.// 1. Define Command
public record CreateTask(string Title) : ICommand;
// 2. Define Handler
public class Handler : ICommandHandler<CreateTask, Result>
{
public async Task<Result> HandleAsync(CreateTask cmd, CancellationToken ct)
=> ResultFactory.Success();
}
// 3. Send via Bus
var result = await bus.SendAsync<CreateTask, Result>(new CreateTask("Fix bug"));