Skip to main content
Open Source .NET Framework

Excalibur + Dispatch

High-performance .NET messaging with first-class HTTP result contracts and secure-by-default authorization — one framework, pick your packages

10.0.0 pre-release. The API is not frozen until RC. Read the known issues before you adopt it.

Why Excalibur?

Start with Excalibur.Dispatch for messaging. Add domain modeling, event sourcing, and sagas as you grow.

First-Class HTTP Result Contracts

Map an action straight to an endpoint with app.DispatchPostAction<TRequest, TAction, TResponse>(route). The framework turns the result into the correct HTTP status — 200 on success, 400/403/500 on failure — so there is no manual result-unwrapping. The differentiator over a hand-rolled MapPost + dispatch + branch.

Secure by Default

Authorize with native ASP.NET Core [Authorize] via a standard AuthorizationHandler<GrantsAuthorizationRequirement>. Grants flow to a pluggable policy engine (Cedar or OPA) and fail closed — any evaluation fault denies the request.

Low-Allocation Messaging

Message dispatching with configurable middleware and a measured 96 B per command. Latency depends on your handler, pipeline and runtime; the measured figures and their conditions are published in the performance docs.

Event Sourcing Built-in

First-class support for event sourcing patterns. Store events, rebuild state, and maintain a complete audit trail of your domain.

Type-Safe by Design

Leverage C# generics and pattern matching for compile-time safety. No magic strings, no runtime surprises.

Middleware Pipeline

Composable middleware for cross-cutting concerns: validation, logging, retry policies, circuit breakers, and more.

Production Ready

Outbox pattern, leader election, OpenTelemetry integration, and health checks. Deploy with confidence.

Drop-in MediatR Replacement

Familiar patterns with enhanced capabilities. Migrate gradually with our compatibility layer.

Which Packages Do You Need?

194 packages across 46 families — install only what your application requires. Every package beyond Excalibur.Dispatch is optional. The Package Matrix lists all of them by category.

ScenarioPackages
Simple messaging (MediatR replacement)Excalibur.Dispatch + Excalibur.Dispatch.Abstractions
Add transport (Kafka, RabbitMQ, etc.)+ Excalibur.Dispatch.Transport.*
Domain modeling (aggregates, entities)+ Excalibur.Domain
Event sourcing with persistence+ Excalibur.EventSourcing + Excalibur.EventSourcing.SqlServer
Full CQRS/hosting with compliance+ Excalibur.Hosting.Web

Quick Start

Get up and running in minutes

Install the messaging core

dotnet add package Excalibur.Dispatch
# For the app.DispatchPostAction HTTP-endpoint helper:
dotnet add package Excalibur.Dispatch.Hosting.AspNetCore

Add packages as your architecture grows

dotnet add package Excalibur.Domain
dotnet add package Excalibur.EventSourcing
dotnet add package Excalibur.Hosting.Web

Write your first handler

Program.cs
// 1. Define an action and its handler
public record GreetAction(string Name) : IDispatchAction<string>;

public class GreetHandler : IActionHandler<GreetAction, string>
{
public Task<string> HandleAsync(GreetAction action, CancellationToken ct)
=> Task.FromResult($"Hello, {action.Name}!");
}

// 2. Register Dispatch — handlers are auto-discovered
builder.Services.AddDispatch();
var app = builder.Build();

// 3. Map the action to an HTTP endpoint. The result becomes the correct
// HTTP status automatically — 200 on success, 400/403/500 on failure.
app.DispatchPostAction<GreetRequest, GreetAction, string>(
"/greet",
(request, _) => new GreetAction(request.Name));

public record GreetRequest(string Name);

Measured Performance

Each figure below carries the date and conditions it was measured under. The comparison against other libraries is mid-refresh, so these numbers do not rank the current source against competitors — follow the link for the full method and how to reproduce them.

96 B
Allocated per command
Measured 17 October 2026, byte-identical across every process.
~60 ns
Command dispatch overhead
Median of three independent processes with a no-op handler.

Ready to Get Started?

Build your first handler in under five minutes — one package, no database and no message broker required.

Coming from something else? MediatR · MassTransit · NServiceBus