Skip to content

Voltimax.Messaging

Azure Service Bus messaging library with a minimal API-style programming model.

Quick Start

csharp
var messaging = builder.Services.AddMessaging(options =>
{
    options.ConnectionString = "your-connection-string";
});

// Map a queue entity and attach a handler
messaging.MapQueue<OrderCreated>("orders")
    .MapHandler(async (OrderCreated msg, IOrderRepository orders, CancellationToken ct) =>
    {
        await orders.CreateAsync(msg, ct);
    });

// Typed sender is auto-registered - inject IMessageSender<OrderCreated>
app.MapPost("/orders", async (CreateOrderRequest req, IMessageSender<OrderCreated> sender, CancellationToken ct) =>
{
    await sender.SendAsync(new OrderCreated(req.CustomerId, req.Items), ct);
    return Results.Accepted();
});

Documentation

TopicDescription
PatternsFire-and-forget, targeted commands, request/reply, polymorphic queues
Core ConceptsHandlers, message context, entity-first registration API
ConfigurationBuilder options, handler config, topology introspection
Error HandlingCustom error handlers, dead letter processing
SessionsSession-enabled queues and subscriptions
Request/ReplyRPC-style request/response messaging
MiddlewareMessage processing pipeline
BatchingHigh-throughput batch processing
ObservabilityOpenTelemetry metrics and tracing
Azure FunctionsFunctions integration
AnalyzersRoslyn analyzers for compile-time checks
TestingIntegration testing with the Service Bus Emulator

Key Features

  • Entity-first API - MapQueue<T>() / MapTopic<T>() return builders for handlers
  • Polymorphic queues - MapPolymorphicQueue() routes multiple message types on one queue via MessageType discriminator
  • Typed senders - IMessageSender<T> auto-registered per entity
  • Minimal API-style handlers - delegates with automatic parameter binding
  • DI integration - inject services directly into handler parameters
  • Fluent configuration - handler-level options for concurrency, prefetch, auto-complete
  • Topology introspection - discover required infrastructure at runtime
  • Test harness - in-memory transport for unit testing
  • Analyzers - catch common mistakes at compile time

Package Structure

text
Voltimax.Messaging                    # Core library
Voltimax.Messaging.HealthChecks       # Health check integration
Voltimax.Messaging.OpenTelemetry      # Telemetry instrumentation
Voltimax.Messaging.Testing            # Test harness and fakes
Voltimax.Messaging.Analyzers          # Roslyn analyzers (ships automatically)