Routya

High-Performance
Message Dispatching

Fast, lightweight CQRS library built for .NET applications. Competitive with MediatR while offering more flexibility and control.

v1.0.5
.NET 8, 9, 10
30% Faster
dotnet add package Routya.Core --version 1.0.5

Built 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

11th Gen Intel Core i7-11800H @ 2.30GHz.NET 8.0.17Windows 11

Request Dispatching

Execution time in nanoseconds

MediatR SendAsyncBaseline
356.3 ns
1016 B0%
Routya SingletonCompetitive
377.8 ns
1008 B+6%
Routya TransientCompetitive
397.0 ns
1032 B+11%
Routya Scoped
427.0 ns
1216 B+20%
Routya Singleton Async
436.8 ns
1168 B+23%
Routya Transient Async
450.2 ns
1192 B+26%
Routya Scoped Async
495.0 ns
1376 B+39%

Notification Dispatching

Execution time in nanoseconds

MediatR PublishBaseline
157.6 ns
440 B0%
Routya Singleton SequentialWinner
110.5 ns
192 B-30%
Routya Singleton Parallel9% Faster
143.6 ns
312 B-9%
Routya Transient Sequential7% Faster
146.0 ns
240 B-7%
Routya Transient Parallel
170.6 ns
360 B+8%
Routya Scoped Sequential
238.1 ns
424 B+51%
Routya Scoped Parallel
265.8 ns
544 B+69%
30%
Faster notification dispatching with Singleton Sequential handlers
56%
Less memory allocation for Singleton notification handlers
7%
Faster notifications with Transient Sequential handlers - maximum isolation with performance
Growing Ecosystem

Complementary Packages

Extend your .NET applications with additional tools built on the same principles of performance and simplicity

Routya.ResultKit

v2.1.0

Lightweight result wrapper, validation and transformation toolkit for clean Result<T> handling.

ValidationResultsTransforms
Consistent Result<T> pattern
One-line validation with .Validate()
Transform() for safe projections
Rich validation attributes
Nested object validation
dotnet add package Routya.ResultKit

Routya.ResultKit.AspNetCore

v2.1.0

ASP.NET Core integration providing seamless ProblemDetails conversion and automatic exception handling.

ASP.NET CoreProblemDetailsMiddleware
Automatic exception handling
RFC 7807 ProblemDetails
Minimal API & MVC support
Custom exception mappers
ToHttpResult() extensions
dotnet add package Routya.ResultKit.AspNetCore

All packages are open source and actively maintained

View All Projects on GitHub

Documentation

Everything you need to get started with Routya in your .NET applications

Quick Start Guide

Installation

dotnet add package Routya.Core --version 2.0.0

Register 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")
);