Muonroi.Messaging.Abstractions 1.0.0-alpha.16

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

Muonroi.Messaging.Abstractions

Vendor-neutral message bus contracts — IMuonroiMessageEnvelope, domain events, saga, outbox, and routing interfaces — that decouple your domain from any broker or transport library.

NuGet License: Apache 2.0

This package ships contracts only — no runtime behavior, no DI registrations, and no dependency on any message-bus library. Your domain code references these interfaces and records; the concrete transport wiring lives in the implementation package Muonroi.Messaging.MassTransit.

Installation

dotnet add package Muonroi.Messaging.Abstractions --prerelease

Quick Start

Implement a domain event and wire up a saga state — both depend only on this abstractions package:

using Muonroi.Messaging.Abstractions.Contracts;
using Muonroi.Messaging.Abstractions.Events;

// 1. Define a domain event (implement IMDomainEvent via the provided base classes)
public record OrderCreatedEvent(Guid OrderId, string Product, decimal Total);

// 2. Publish with a typed envelope
var envelope = new MuonroiMessageEnvelope
{
    TenantId   = "tenant-42",
    UserId     = "usr-001",
    CorrelationId = Guid.NewGuid().ToString("N"),   // auto-generated if omitted
    SentAt     = DateTimeOffset.UtcNow              // auto-generated if omitted
};

// 3. Implement a tenant-aware saga state
public class OrderSaga : IMuonroiSaga
{
    public Guid     CorrelationId        { get; set; }
    public string?  TenantId             { get; set; }
    public DateTime CreationTime         { get; set; }
    public DateTime? LastModificationTime { get; set; }
}

// 4. Implement a message router to redirect or dead-letter messages
public class TenantRouter : IMessageRouter<OrderCreatedEvent>
{
    public int    Order => 10;
    public string Code  => "TENANT_ROUTER";

    public Task<IRoutingDecision> RouteAsync(
        OrderCreatedEvent message,
        IRoutingContext context,
        CancellationToken ct = default)
    {
        if (string.IsNullOrEmpty(context.TenantId))
            return Task.FromResult(RoutingDecision.DeadLetter("Missing tenant"));

        return Task.FromResult(RoutingDecision.PassThrough);
    }
}

For end-to-end runtime behavior — broker setup, consumers, outbox relay, and telemetry — see Muonroi.Messaging.MassTransit and the Quickstart.Messaging sample.

Features

  • IMuonroiMessageEnvelope / MuonroiMessageEnvelope — immutable message envelope carrying TenantId, UserId, Username, CorrelationId, AccessToken, and SentAt
  • Domain event base classesMEntityCreatedEvent<T>, MEntityChangedEvent<T>, MEntityDeletedEvent<T>, MEntitiesCreatedEvent<T>, MEntitiesChangedEvent<T>, MEntitiesDeletedEvent<T> implementing IMDomainEvent
  • Internal mediator events — parallel INotification-based variants for in-process pub/sub via Muonroi.Mediator
  • IMuonroiSaga — vendor-neutral saga state contract (tenant-scoped, CorrelationId primary key, timestamps); bridges to MassTransit.ISaga in the adapter package
  • IMessageRouter<TMessage> / IRoutingContext — pluggable, ordered routing pipeline that returns an explicit IRoutingDecision
  • RoutingDecision — immutable record with PassThrough, RedirectTo(address), and DeadLetter(reason) factory methods
  • IMessageRoutingRule<TMessage> — legacy approve/reject routing rule (extend IRule<TMessage> for FactBag-aware evaluation)
  • IOutboxRelayService — contract for background outbox relay (RelayPendingAsync)
  • EventOutbox / IEventOutboxStore — outbox entity and persistence contract with Pending, Published, Failed statuses
  • [Idempotent] — attribute marking a consumer class as requiring inbox-based idempotent processing
  • MessageBusTelemetryDescriptorITelemetryDescriptor exposing the ActivitySource and Meter names for OpenTelemetry wiring

API Reference

Type Purpose
IMuonroiMessageEnvelope Message envelope contract (tenant, user, correlation, token, timestamp)
MuonroiMessageEnvelope Sealed, init-only concrete envelope
MEntityCreatedEvent<T> Domain event for a single entity creation
MEntityChangedEvent<T> Domain event for a single entity update
MEntityDeletedEvent<T> Domain event for a single entity deletion
MEntitiesCreatedEvent<T> Domain event for bulk entity creation
MEntitiesChangedEvent<T> Domain event for bulk entity update
MEntitiesDeletedEvent<T> Domain event for bulk entity deletion
IMuonroiSaga Vendor-neutral saga state (extends ITenantScoped)
IMessageRouter<TMessage> Ordered routing decision for a message type
IRoutingContext Ambient metadata provided to a router (tenant, correlation, headers)
IRoutingDecision Routing outcome: pass-through, redirect, or dead-letter
RoutingDecision Default immutable IRoutingDecision record with static factory methods
IMessageRoutingRule<TMessage> Legacy approve/reject routing rule marker
IOutboxRelayService Outbox background relay contract
EventOutbox Persistent outbox record (EventName, EventContent, Status, ErrorMessage)
EventOutboxStatus Pending, Published, Failed enum
IEventOutboxStore Outbox persistence contract (EventOutboxes, AddAsync, SaveChangesAsync)
IdempotentAttribute Marks a consumer class for inbox-based idempotency
MessageBusTelemetryDescriptor Exposes ActivitySource and Meter names for OTel registration

Samples

  • Quickstart.Messaging — full messaging demo: IMessageRouter implementation, MuonroiConsumerBase<T> consumers, AddMessageBus() (RabbitMQ) or in-memory fallback, and outbox relay

Compatibility

  • Target framework: net8.0
  • License: Apache-2.0 (OSS)

License

Apache-2.0. See LICENSE-APACHE for the full text.

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 (3)

Showing the top 3 NuGet packages that depend on Muonroi.Messaging.Abstractions:

Package Downloads
Muonroi.Data.EntityFrameworkCore

Entity Framework Core infrastructure for Muonroi: MDbContext with audit, soft-delete, multi-tenant filters, and repository base.

Muonroi.Messaging.MassTransit

Package Description

Muonroi.Data.EntityFrameworkCore.Events

Event dispatch, outbox persistence, and saga support for Muonroi Data.EntityFrameworkCore. Adds Mediator and Messaging integration on top of the persistence-only core.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.16 88 6/22/2026
1.0.0-alpha.15 168 5/31/2026
1.0.0-alpha.14 164 5/15/2026
1.0.0-alpha.13 140 5/2/2026
1.0.0-alpha.12 102 4/2/2026
1.0.0-alpha.11 145 4/2/2026
1.0.0-alpha.9 80 3/30/2026
1.0.0-alpha.8 173 3/28/2026
1.0.0-alpha.7 75 3/27/2026
1.0.0-alpha.5 68 3/27/2026
1.0.0-alpha.4 78 3/27/2026
1.0.0-alpha.3 67 3/27/2026
1.0.0-alpha.2 71 3/26/2026
1.0.0-alpha.1 99 3/8/2026