Muonroi.Messaging.Abstractions
1.0.0-alpha.16
dotnet add package Muonroi.Messaging.Abstractions --version 1.0.0-alpha.16
NuGet\Install-Package Muonroi.Messaging.Abstractions -Version 1.0.0-alpha.16
<PackageReference Include="Muonroi.Messaging.Abstractions" Version="1.0.0-alpha.16" />
<PackageVersion Include="Muonroi.Messaging.Abstractions" Version="1.0.0-alpha.16" />
<PackageReference Include="Muonroi.Messaging.Abstractions" />
paket add Muonroi.Messaging.Abstractions --version 1.0.0-alpha.16
#r "nuget: Muonroi.Messaging.Abstractions, 1.0.0-alpha.16"
#:package Muonroi.Messaging.Abstractions@1.0.0-alpha.16
#addin nuget:?package=Muonroi.Messaging.Abstractions&version=1.0.0-alpha.16&prerelease
#tool nuget:?package=Muonroi.Messaging.Abstractions&version=1.0.0-alpha.16&prerelease
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.
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 carryingTenantId,UserId,Username,CorrelationId,AccessToken, andSentAt- Domain event base classes —
MEntityCreatedEvent<T>,MEntityChangedEvent<T>,MEntityDeletedEvent<T>,MEntitiesCreatedEvent<T>,MEntitiesChangedEvent<T>,MEntitiesDeletedEvent<T>implementingIMDomainEvent - Internal mediator events — parallel
INotification-based variants for in-process pub/sub viaMuonroi.Mediator IMuonroiSaga— vendor-neutral saga state contract (tenant-scoped,CorrelationIdprimary key, timestamps); bridges toMassTransit.ISagain the adapter packageIMessageRouter<TMessage>/IRoutingContext— pluggable, ordered routing pipeline that returns an explicitIRoutingDecisionRoutingDecision— immutable record withPassThrough,RedirectTo(address), andDeadLetter(reason)factory methodsIMessageRoutingRule<TMessage>— legacy approve/reject routing rule (extendIRule<TMessage>for FactBag-aware evaluation)IOutboxRelayService— contract for background outbox relay (RelayPendingAsync)EventOutbox/IEventOutboxStore— outbox entity and persistence contract withPending,Published,Failedstatuses[Idempotent]— attribute marking a consumer class as requiring inbox-based idempotent processingMessageBusTelemetryDescriptor—ITelemetryDescriptorexposing theActivitySourceandMeternames 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:
IMessageRouterimplementation,MuonroiConsumerBase<T>consumers,AddMessageBus()(RabbitMQ) or in-memory fallback, and outbox relay
Compatibility
- Target framework:
net8.0 - License: Apache-2.0 (OSS)
Related Packages
Muonroi.Messaging.MassTransit— runtime implementation:AddMessageBus(),AddOutboxRelay(),MuonroiConsumerBase<T>, RabbitMQ transport, filters, and OpenTelemetryMuonroi.Core.Abstractions—MEntitybase class used by domain event genericsMuonroi.Tenancy.Abstractions—ITenantScopedextended byIMuonroiSagaMuonroi.Mediator—INotificationused by in-process internal event variants
License
Apache-2.0. See LICENSE-APACHE for the full text.
| Product | Versions 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. |
-
net8.0
- Muonroi.Core (>= 1.0.0-alpha.16)
- Muonroi.Core.Abstractions (>= 1.0.0-alpha.16)
- Muonroi.Mediator (>= 1.0.0-alpha.16)
- Muonroi.Tenancy.Abstractions (>= 1.0.0-alpha.16)
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 |