
High-Performance
Message Dispatching
Fast, lightweight CQRS library built for .NET applications. Competitive with MediatR while offering more flexibility and control.
dotnet add package Routya.Coredotnet add package Routya.SourceGeneratorsBuilt for Performance
Everything you need for high-performance CQRS message dispatching in modern .NET applications
Blazing Fast
High-performance dispatching with registry-based optimization. 30% faster than MediatR for notifications with Singleton handlers.
Configurable Lifetimes
Choose Singleton, Scoped, or Transient per handler. Optimize for your specific use case with flexible lifetime management.
Pipeline Behaviors
Optional cross-cutting concerns support. Add logging, validation, and custom behaviors that execute around your requests.
CQRS Pattern
Clean interface-based abstraction for Requests/Responses and Notifications. Minimal overhead with maximum clarity.
Parallel & Sequential
Supports both sequential and parallel notification dispatching. Choose the right strategy for your scenario.
Memory Efficient
Zero memory leaks with proper scope management. 56% less memory than MediatR for Singleton notification handlers.
Proven Performance
Benchmarked against MediatR 13.1.0 using BenchmarkDotNet on .NET 8
Request Dispatching
Execution time in nanoseconds
Notification Dispatching
Execution time in nanoseconds
Documentation
Everything you need to get started with Routya in your .NET applications
Quick Start Guide
Installation
dotnet add package Routya.CoreFor peak performance, install the source generator — it emits compile-time handler registrations and eliminates reflection overhead at runtime.
dotnet add package Routya.SourceGeneratorsRegister Services
// Register with assembly scanning
builder.Services.AddRoutya(
cfg => cfg.Scope = RoutyaDispatchScope.Scoped,
Assembly.GetExecutingAssembly()
);Define a Request
public class HelloRequest(string name) : IRequest<string>
{
public string Name { get; } = name;
}Create a Handler
public class HelloHandler : IAsyncRequestHandler<HelloRequest, string>
{
public async Task<string> HandleAsync(
HelloRequest request,
CancellationToken cancellationToken)
{
return await Task.FromResult($"Hello, {request.Name}!");
}
}Dispatch the Request
var result = await _dispatcher.SendAsync<HelloRequest, string>(
new HelloRequest("World")
);