Why Excalibur?
Start with Excalibur.Dispatch for messaging. Add domain modeling, event sourcing, and sagas as you grow.
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.
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 message dispatching with minimal overhead. Ultra-local dispatch at ~35 ns / 24 B -- 1.28x faster than MediatR with 6.3x less memory. Zero-allocation handler internals.
First-class support for event sourcing patterns. Store events, rebuild state, and maintain a complete audit trail of your domain.
Leverage C# generics and pattern matching for compile-time safety. No magic strings, no runtime surprises.
Composable middleware for cross-cutting concerns: validation, logging, retry policies, circuit breakers, and more.
Outbox pattern, leader election, OpenTelemetry integration, and health checks. Deploy with confidence.
Familiar patterns with enhanced capabilities. Migrate gradually with our compatibility layer.
Which Packages Do You Need?
Install only what your application requires. Every package is optional.
| Scenario | Packages |
|---|---|
| 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
// 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);
Performance at a Glance
Benchmarked on .NET 10, Intel Core i9-14900K — real numbers, no marketing claims
Ready to Get Started?
Join developers building fast, reliable .NET applications with Excalibur