ModulusKit.Messaging.Abstractions 4.0.0

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

Modulus.Messaging.Abstractions

Abstractions for the Modulus messaging system — IMessageBus, IIntegrationEvent, and outbox pattern interfaces.

Installation

dotnet add package ModulusKit.Messaging.Abstractions

Key Types

Integration Events

// Define an integration event
public record OrderShipped(Guid OrderId, DateTime ShippedAt)
    : IntegrationEvent;

// IntegrationEvent base class auto-generates:
//   EventId      = Guid.NewGuid()
//   OccurredOn   = DateTime.UtcNow
//   CorrelationId = null (optional, settable via init)

Message Bus

public interface IMessageBus
{
    // Publish an event to all subscribers
    Task Publish<TEvent>(TEvent @event, CancellationToken ct = default)
        where TEvent : IIntegrationEvent;
}

Integration Event Handlers

public class OrderShippedHandler : IIntegrationEventHandler<OrderShipped>
{
    public Task Handle(OrderShipped @event, CancellationToken ct)
    {
        // React to the cross-module event
        return Task.CompletedTask;
    }
}

Outbox Pattern

The IOutboxStore interface enables the transactional outbox pattern — events are stored as database rows, then published reliably by a background processor with per-row retry backoff and dead-lettering. (Whether the row commits in the same transaction as your business data depends on how the store is configured — see the outbox documentation for the two supported setups.)

public interface IOutboxStore
{
    Task Save(IIntegrationEvent @event, CancellationToken cancellationToken = default);

    Task<IReadOnlyList<OutboxMessage>> ClaimPending(string ownerId, TimeSpan lease, int batchSize, int maxAttempts, CancellationToken cancellationToken = default);

    Task<int> CountPending(int maxAttempts, CancellationToken cancellationToken = default);

    Task MarkAsProcessed(string ownerId, IEnumerable<Guid> ids, CancellationToken cancellationToken = default);

    Task MarkAsFailed(string ownerId, Guid messageId, string error, DateTime? nextAttemptOnUtc, CancellationToken cancellationToken = default);
}

ClaimPending atomically claims rows for the caller's ownerId (a portable, EF-ExecuteUpdateAsync-based optimistic claim — no provider-specific row locking), so multiple dispatcher instances polling the same table never publish the same row twice; it skips dead-lettered rows (Attempts >= maxAttempts) and rows whose NextAttemptOnUtc backoff has not elapsed. MarkAsProcessed/MarkAsFailed only act on rows ownerId still holds the claim on; MarkAsFailed records the failure, the next-attempt time computed from the retry policy, and releases the claim so the row is immediately reclaimable once its backoff elapses. A claim's lease (MessagingOptions.OutboxClaimLease) expiring — e.g. because the owning instance crashed — is what makes an in-flight row recoverable without operator intervention. The inbox counterpart, IInboxStore, provides per-handler idempotent consumption (reserve → execute → mark processed, with reservation release on dead-letter).

Learn More

See the Modulus repository for full documentation.

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 is compatible.  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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ModulusKit.Messaging.Abstractions:

Package Downloads
ModulusKit.Messaging

Messaging library for .NET modular monoliths with transactional outbox/inbox, consumer retry, and an in-memory transport. RabbitMQ and Azure Service Bus transports ship as ModulusKit.Messaging.RabbitMq and ModulusKit.Messaging.AzureServiceBus.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.0 175 7/26/2026
3.1.0 359 7/26/2026
3.0.0 283 7/26/2026
2.1.0 145 7/4/2026
2.0.0 138 7/3/2026
1.2.5 137 3/15/2026
1.2.4 123 3/15/2026
1.2.3 117 3/14/2026
1.2.2 119 3/14/2026
1.2.1 120 3/14/2026
1.2.0 124 3/14/2026
1.1.1 131 3/8/2026
1.1.0 118 3/5/2026
1.0.1 130 3/3/2026