UltraSpeedBus 1.5.0

dotnet add package UltraSpeedBus --version 1.5.0
                    
NuGet\Install-Package UltraSpeedBus -Version 1.5.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="UltraSpeedBus" Version="1.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UltraSpeedBus" Version="1.5.0" />
                    
Directory.Packages.props
<PackageReference Include="UltraSpeedBus" />
                    
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 UltraSpeedBus --version 1.5.0
                    
#r "nuget: UltraSpeedBus, 1.5.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 UltraSpeedBus@1.5.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=UltraSpeedBus&version=1.5.0
                    
Install as a Cake Addin
#tool nuget:?package=UltraSpeedBus&version=1.5.0
                    
Install as a Cake Tool

UltraSpeedBus

UltraSpeedBus is a free, open-source messaging framework for .NET, engineered for high-performance and reliability in distributed systems. It simplifies building scalable applications through message-based, asynchronous communication, enabling loose coupling between services while delivering enhanced availability, fault tolerance, and scalability.

Packages

Package Name Description
UltraSpeedBus The core library with message transport, context, pipelines, and integration implementations.
UltraSpeedBus.Abstractions Contains the core contracts, interfaces, and message envelope definitions for the system.
UltraSpeedBus.Extensions.DependencyInjection Inject your dependencies

Features

  • High-performance messaging for .NET applications
  • Supports distributed architectures with command, event, and saga patterns
  • Pluggable transports, starting with Azure Service Bus (others planned: SQL Server, MySQL, PostgreSQL, MongoDB, AWS SQS/SNS, OCI, GCP Pub/Sub)
  • Saga implementations, error handling, and retries
  • Observability using OpenTelemetry
  • Free and open-source, easy to extend for custom requirements

Getting Started

# Install the packages via NuGet
dotnet add package UltraSpeedBus
dotnet add package UltraSpeedBus.Abstractions
dotnet add package UltraSpeedBus.Extensions.DependencyInjection

Configure your Program

using UltraSpeedBus.Abstractions;
using UltraSpeedBus.Abstractions.Contracts;
using UltraSpeedBus.Abstractions.Mediator;
using UltraSpeedBus.Extensions.DepedencyInjection;
using UltraSpeedBus.WebAPI;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddUltraSpeedBus(); // Add this method extensions: AddUltraSpeedBus()

// Configure your Command, Query and Event handlers
builder.Services.AddSingleton<ICommandHandler<CreateOrder, OrderResult>, CreateOrderHandler>();
builder.Services.AddSingleton<IQueryHandler<GetOrder, OrderDto?>, GetOrderQueryHandler>();
builder.Services.AddSingleton<IEventHandler<OrderCreated>, OrderCreatedEventHandler>();

var app = builder.Build();

// more configurations

// Get the mediator instance
var mediator = app.Services.GetRequiredService<IMediator>();


// Register your Commandhandler for CreateOrder record
mediator.RegisterCommandHandler<CreateOrder, OrderResult>(
    (ctx) => app.Services.GetRequiredService<ICommandHandler<CreateOrder, OrderResult>>().Handle(ctx)
);


// Register your QueryHandler for GetOrder record
mediator.RegisterQueryHandler<GetOrder, OrderDto?>(
    (ctx) => app.Services.GetRequiredService<IQueryHandler<GetOrder, OrderDto?>>().Handle(ctx)
);

// Register your EventHandler for GetOrder record
mediator.RegisterEventHandler<OrderCreated>(
    (ctx) => app.Services.GetRequiredService<IEventHandler<OrderCreated>>().Handle(ctx)
);

// Use Minimal APIS

app.MapPost("/orders", async (CreateOrder command, ISend sender) =>
{
    var result = await sender.SendAsync<CreateOrder, OrderResult>(command);
    return Results.Ok(result);
});

// GET /orders/{id} -> Send Query
app.MapGet("/orders/{id:int}", async (int id, ISend sender) =>
{
    var result = await sender.SendAsync<GetOrder, OrderDto?>(new GetOrder(id));
    if (result is null)
        return Results.NotFound();

    return Results.Ok(result);
});

// POST /simulate -> Publish Event directly
app.MapPost("/simulate", async (IPublish publisher) =>
{
    await publisher.PublishAsync(new OrderCreated(999));
    return Results.Ok("Event Published");
});

// Example: Dynamic event consumer (runtime registration)
mediator.ConnectHandlerAsync<OrderCreated>(async ctx =>
{
    Console.WriteLine($"[Dynamic Consumer] Order created with {ctx.Message.OrderId}");
});

app.Run();

Command handler

using UltraSpeedBus;
using UltraSpeedBus.Abstractions;

// Create a command and command Handler with ICommandHandler
public sealed record CreateOrderCommand(string Product, int Quantity);
public sealed record OrderResult(int OrderId);

public class CreateOrderHandler : ICommandHandler<CreateOrderCommand, OrderResult>
{
    public Task<OrderResult> Handle(CommandContext<CreateOrderCommand> request)
    {
        int generatedId = Random.Shared.Next(1000, 9999);
        return Task.FromResult(new OrderResult(generatedId));
    }
}

Query Handler

public sealed record GetOrderQuery(int OrderId);
public sealed record OrderDto(int OrderId, string Description);

public class GetOrderQueryHandler : IQueryHandler<GetOrderQuery, OrderDto?>
{
    public Task<OrderDto?> Handle(QueryContext<GetOrderQuery> context)
    {
        if (context.Query.OrderId == 42)
        {
            return Task.FromResult<OrderDto?>(new OrderDto(42, "Example Order"));
        }

        return Task.FromResult<OrderDto?>(null);
    }
}

Event Handler

public sealed record OrderCreatedEvent(int OrderId);

public class OrderCreatedEventHandler : IEventHandler<OrderCreatedEvent>
{
    public Task Handle(EventContext<OrderCreatedEvent> context)
    {
        Console.WriteLine($"[Event] Order created → Id = {context.Event.OrderId}");
        return Task.CompletedTask;
    }
}

Contributing

Contributions are welcome! Please open issues or submit pull requests to help improve UltraSpeedBus.

License

This project is licensed under the MIT License.

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 was computed.  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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on UltraSpeedBus:

Package Downloads
UltraSpeedBus.Extensions.DependencyInjection

Dependency Injection for UltraSpeedBus

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.0 200 11/28/2025
1.4.0 199 11/26/2025
1.3.0 406 11/18/2025
1.2.5 280 11/16/2025
1.2.4 277 11/16/2025