MongoDbRepository.Extensions.Outbox.MessageBus
6.4.3
dotnet add package MongoDbRepository.Extensions.Outbox.MessageBus --version 6.4.3
NuGet\Install-Package MongoDbRepository.Extensions.Outbox.MessageBus -Version 6.4.3
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="MongoDbRepository.Extensions.Outbox.MessageBus" Version="6.4.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MongoDbRepository.Extensions.Outbox.MessageBus" Version="6.4.3" />
<PackageReference Include="MongoDbRepository.Extensions.Outbox.MessageBus" />
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 MongoDbRepository.Extensions.Outbox.MessageBus --version 6.4.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MongoDbRepository.Extensions.Outbox.MessageBus, 6.4.3"
#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 MongoDbRepository.Extensions.Outbox.MessageBus@6.4.3
#: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=MongoDbRepository.Extensions.Outbox.MessageBus&version=6.4.3
#tool nuget:?package=MongoDbRepository.Extensions.Outbox.MessageBus&version=6.4.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MongoDbRepository.Extensions.Outbox.MessageBus
Bridges your local, database-backed transactional outbox table smoothly with enterprise service brokers while introducing robust distributed idempotency controls.
🌟 Features
- Pluggable Event Dispatch Adapter: Implements
IOutboxMessageHandlerto intercept raw outbox storage records, safely de-serialize content strings back into concrete integration models, and publish them to an external message broker. - Type-Safe Idempotency Ledger: Implements a database-backed deduplication layer mapped tightly to the core v6 repository structure using a native
ObjectIdidentity primitive. - Ecosystem Index Integration: Includes an index provider that hooks into the framework’s
AddAutomatedIndexes()tool to build an atomic compound unique key constraint (MessageId+ConsumerName), supporting multiple independent consumer groups safely.
🚀 Quick Start
1. Configure the Broker Routing Layer (Program.cs)
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMongoDbRepositoryCore(builder.Configuration.GetSection("MongoDb"));
// Bind the outbox string signatures directly to your concrete event contracts
builder.Services.AddMongoDbOutboxMessageBusDispatcher(registry =>
{
registry.RegisterEvent<OrderCompletedIntegrationEvent>("OrderCompleted");
});
// Automatically provisions the unique ledger constraints out-of-band via assembly scanning
builder.Services.AddAutomatedIndexes();
2. Apply the Duplicate Delivery Guard inside a Broker Consumer
Inject the IIdempotentConsumerGuard to protect downstream execution blocks from network retry delivery duplications:
C#
using MassTransit;
using MongoDbRepository.Extensions.Outbox.MessageBus.Deduplication;
public sealed class OrderCompletedConsumer(IIdempotentConsumerGuard idempotencyGuard)
: IConsumer<OrderCompletedIntegrationEvent>
{
public async Task Consume(ConsumeContext<OrderCompletedIntegrationEvent> context)
{
string messageId = context.MessageId?.ToString() ?? context.Message.OrderId.ToString();
string consumerGroup = nameof(OrderCompletedConsumer);
// Executes an atomic database-level index check.
// Returns false instantly if another container node or pod already handled this message.
if (!await idempotencyGuard.TryAcquireProcessingLockAsync(messageId, consumerGroup, context.CancellationToken))
{
return; // Safe exit point for duplicate deliveries
}
// Proceed with your unique business modifications safely here...
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- MassTransit.Abstractions (>= 9.1.2)
- MongoDbRepositoryCore (>= 6.4.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.