LiteBus.Runtime.Abstractions 4.1.0

dotnet add package LiteBus.Runtime.Abstractions --version 4.1.0
                    
NuGet\Install-Package LiteBus.Runtime.Abstractions -Version 4.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LiteBus.Runtime.Abstractions" Version="4.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LiteBus.Runtime.Abstractions" Version="4.1.0" />
                    
Directory.Packages.props
<PackageReference Include="LiteBus.Runtime.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LiteBus.Runtime.Abstractions --version 4.1.0
                    
#r "nuget: LiteBus.Runtime.Abstractions, 4.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LiteBus.Runtime.Abstractions@4.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LiteBus.Runtime.Abstractions&version=4.1.0
                    
Install as a Cake Addin
#tool nuget:?package=LiteBus.Runtime.Abstractions&version=4.1.0
                    
Install as a Cake Tool

<h1 align="center"> <a href="https://github.com/litenova/LiteBus"> <img src="assets/logo/icon.png" alt="LiteBus Logo" width="128"> </a> <br> LiteBus </h1>

<h4 align="center">A lightweight, high-performance mediator for building clean, scalable, and testable .NET applications with CQS and DDD.</h4>

<p align="center"> <a href="https://github.com/litenova/LiteBus/actions/workflows/release.yml"> <img src="https://github.com/litenova/LiteBus/actions/workflows/release.yml/badge.svg" alt="Build Status" /> </a> <a href="https://codecov.io/gh/litenova/LiteBus" > <img src="https://codecov.io/gh/litenova/LiteBus/graph/badge.svg?token=XBNYITSV5A" alt="Code Coverage" /> </a> <a href="https://www.nuget.org/packages/LiteBus.Commands.Extensions.Microsoft.DependencyInjection"> <img src="https://img.shields.io/nuget/vpre/LiteBus.Commands.Extensions.Microsoft.DependencyInjection.svg" alt="NuGet Version" /> </a> </p>

<p align="center"> For detailed documentation and examples, please visit the <strong><a href="https://github.com/litenova/LiteBus/wiki">Wiki</a></strong>. </p>

LiteBus is an in-process mediator designed from the ground up for modern .NET. It helps you implement Command Query Separation (CQS) and Domain-Driven Design (DDD) patterns by providing a clean, decoupled architecture for your application's business logic.

Why Choose LiteBus?

  • CQS & DDD First-Class Citizens: Enforces clean architecture with distinct, semantic contracts like ICommand<TResult>, IQuery<TResult>, and IEvent. You can even publish pure POCO domain events without coupling your model to the framework.

  • Optimized for High Performance: Minimizes runtime overhead by discovering and caching handler metadata at startup. Handlers are resolved lazily from your DI container, and large datasets are handled efficiently with IAsyncEnumerable<T> streaming via IStreamQuery<T>.

  • Granular Pipeline Customization: Go beyond simple behaviors with a full pipeline of pre-handlers, post-handlers, and error handlers. Filter handlers by context using [HandlerTag] attributes and dynamic predicates.

  • Advanced Event Concurrency: Take full control over your event processing. Configure Sequential or Parallel execution for both priority groups and for handlers within the same group, allowing you to fine-tune your application's throughput and determinism.

  • DI-Agnostic & Resilient: Decoupled from any specific DI container, with first-class support for Microsoft DI and Autofac. It also includes a built-in Durable Command Inbox for guaranteed, at-least-once execution of critical commands.

Quick Example

Here’s how to define and handle a command to create a new product.

1. Define the Command

A command is a simple object representing a request. This one returns the Guid of the new product.

public sealed record CreateProductCommand(string Name, decimal Price) : ICommand<Guid>;
2. Implement the Handler

The handler contains the business logic to process the command.

public sealed class CreateProductCommandHandler : ICommandHandler<CreateProductCommand, Guid>
{
    private readonly IProductRepository _repository;

    public CreateProductCommandHandler(IProductRepository repository) => _repository = repository;

    public async Task<Guid> HandleAsync(CreateProductCommand command, CancellationToken cancellationToken)
    {
        var product = new Product(command.Name, command.Price);
        await _repository.AddAsync(product, cancellationToken);
        return product.Id;
    }
}
3. Configure and Use

Register LiteBus in Program.cs and inject ICommandMediator to send your command.

// In Program.cs
builder.Services.AddLiteBus(liteBus =>
{
    // This registers the Command Module and scans the assembly for handlers.
    // The core MessageModule is included automatically.
    liteBus.AddCommandModule(module =>
    {
        module.RegisterFromAssembly(typeof(Program).Assembly);
    });
});

// In your API Controller
[ApiController]
public class ProductsController : ControllerBase
{
    private readonly ICommandMediator _commandMediator;

    public ProductsController(ICommandMediator commandMediator) => _commandMediator = commandMediator;

    [HttpPost]
    public async Task<IActionResult> Create(CreateProductCommand command)
    {
        var productId = await _commandMediator.SendAsync(command);
        return CreatedAtAction(nameof(GetById), new { id = productId }, productId);
    }
}

Installation

The recommended way to get started is by installing the extension package for your DI container and the modules you need.

For Microsoft Dependency Injection
dotnet add package LiteBus.Commands.Extensions.Microsoft.DependencyInjection
dotnet add package LiteBus.Queries.Extensions.Microsoft.DependencyInjection
dotnet add package LiteBus.Events.Extensions.Microsoft.DependencyInjection

Documentation

For comprehensive guides, advanced features, and best practices, please visit the LiteBus Wiki.

Key pages include:

Available Packages

The LiteBus ecosystem is split into several packages so you can install only what you need.

Core Modules & Abstractions
Package Version
LiteBus.Commands NuGet version
LiteBus.Commands.Abstractions NuGet version
LiteBus.Queries NuGet version
LiteBus.Queries.Abstractions NuGet version
LiteBus.Events NuGet version
LiteBus.Events.Abstractions NuGet version
LiteBus.Messaging NuGet version
LiteBus.Messaging.Abstractions NuGet version
Runtime & DI Extensions
Package Version
LiteBus.Runtime NuGet version
LiteBus.Runtime.Abstractions NuGet version
LiteBus.Commands.Extensions.Microsoft.DependencyInjection NuGet version
LiteBus.Commands.Extensions.Autofac NuGet version
LiteBus.Commands.Extensions.Microsoft.Hosting NuGet version
(Query and Event extensions follow the same pattern)

Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request.

License

LiteBus is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on LiteBus.Runtime.Abstractions:

Package Downloads
LiteBus.Messaging.Abstractions

LiteBus is a lightweight, flexible in-process mediator for implementing Command Query Separation (CQS) patterns in .NET applications.

LiteBus.Messaging

LiteBus is a lightweight, flexible in-process mediator for implementing Command Query Separation (CQS) patterns in .NET applications.

LiteBus.Events

LiteBus is a lightweight, flexible in-process mediator for implementing Command Query Separation (CQS) patterns in .NET applications.

LiteBus.Commands

LiteBus is a lightweight, flexible in-process mediator for implementing Command Query Separation (CQS) patterns in .NET applications.

LiteBus.Queries

LiteBus is a lightweight, flexible in-process mediator for implementing Command Query Separation (CQS) patterns in .NET applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.1.0 134 10/30/2025
4.0.0 2,224 9/18/2025