Franz.Common.MongoDB
1.6.2
dotnet add package Franz.Common.MongoDB --version 1.6.2
NuGet\Install-Package Franz.Common.MongoDB -Version 1.6.2
<PackageReference Include="Franz.Common.MongoDB" Version="1.6.2" />
<PackageVersion Include="Franz.Common.MongoDB" Version="1.6.2" />
<PackageReference Include="Franz.Common.MongoDB" />
paket add Franz.Common.MongoDB --version 1.6.2
#r "nuget: Franz.Common.MongoDB, 1.6.2"
#:package Franz.Common.MongoDB@1.6.2
#addin nuget:?package=Franz.Common.MongoDB&version=1.6.2
#tool nuget:?package=Franz.Common.MongoDB&version=1.6.2
Got it ✅ — let’s update the README for Franz.Common.MongoDB v1.6.2 to reflect all the new changes we introduced (Inbox store, Outbox store, DLQ, indexes, DI extensions, etc.).
Here’s the rewritten version:
# Franz.Common.MongoDB
A library within the **Franz Framework** designed to streamline the integration of MongoDB into .NET applications.
This package provides utilities for configuring MongoDB services, registering them with dependency injection, and enabling reliable **messaging persistence** patterns such as **Outbox** and **Inbox**.
---
## ✨ Features
- **MongoDB Service Registration**
- `MongoServiceRegistration` for simplified client and database registration.
- Options-driven configuration via `MongoOptions`.
- **📦 Outbox Support**
- `MongoMessageStore` for storing pending messages.
- Automatic retry and **Dead Letter Queue (DLQ)** support.
- Auto-created indexes on:
- `SentOn` (pending lookups)
- `RetryCount` (retry cycles)
- `CreatedOn` (cleanup/archival)
- **📥 Inbox Support**
- `MongoInboxStore` ensures **idempotent message consumption**.
- Unique index on processed message IDs prevents duplicates.
- **⚙️ Dependency Injection**
- Extensions for clean setup:
- `AddMongoMessageStore`
- `AddMongoInboxStore`
- `AddMongoDB`
- **🔒 Reliability**
- Atomic updates for retries (`UpdateRetryAsync`).
- Safe move to dead-letter collection (`MoveToDeadLetterAsync`).
- Mark-as-sent functionality for outbox messages.
---
## 📂 Project Structure
Franz.Common.MongoDB/ ├── Configuration/ │ └── MongoOptions.cs ├── Outbox/ │ ├── MongoMessageStore.cs │ └── DeadLetterCollection.cs ├── Inbox/ │ └── MongoInboxStore.cs ├── Extensions/ │ └── ServiceCollectionExtensions.cs └── MongoServiceRegistration.cs
---
## ⚙️ Configuration
`appsettings.json`:
```json
"Mongo": {
"ConnectionString": "mongodb://localhost:27017",
"DatabaseName": "MessagingDb",
"OutboxCollection": "OutboxMessages",
"DeadLetterCollection": "DeadLetterMessages",
"InboxCollection": "InboxMessages"
}
🚀 Dependency Injection Setup
builder.Services.AddMongoDB(options =>
{
options.ConnectionString = "mongodb://localhost:27017";
options.DatabaseName = "MessagingDb";
});
builder.Services.AddMongoMessageStore(configuration);
builder.Services.AddMongoInboxStore(configuration);
🔄 Usage
Outbox Message Store
var message = new StoredMessage
{
Id = Guid.NewGuid().ToString(),
Body = "{ \"OrderId\": 123 }",
CreatedOn = DateTime.UtcNow
};
await _messageStore.SaveAsync(message);
Inbox Message Store
if (!await _inboxStore.HasProcessedAsync(message.Id))
{
await _dispatcher.PublishAsync(orderCreatedEvent);
await _inboxStore.MarkProcessedAsync(message.Id);
}
📊 Observability
- Mongo collections come with indexes for performance.
- Logs include retries ⚠️, DLQ moves 🔥, and successful sends ✅.
- OpenTelemetry hooks enabled via higher-level messaging layer.
📌 Roadmap
- TTL indexes for automatic cleanup of old outbox/inbox entries.
- Configurable sharding/replica set support for large-scale deployments.
- RabbitMQ-backed inbox/outbox stores (parallel to Kafka).
📝 Version Information
- Current Version: 1.6.2
- Part of the private Franz Framework ecosystem.
📜 License
This library is licensed under the MIT License. See the LICENSE
file for details.
📖 Changelog
Version 1.2.65
- Added
MongoServiceRegistration
for streamlined MongoDB service configuration and registration. - Introduced support for custom MongoDB configurations.
Version 1.3
- Upgraded to .NET 9.0.8.
- Added new features and improvements.
- Separated business concepts from mediator concepts.
- Now compatible with both the in-house mediator and MediatR.
Version 1.6.2
Introduced Mongo Outbox (
MongoMessageStore
) with retries and Dead Letter Queue.Added Mongo Inbox (
MongoInboxStore
) for idempotent consumption.Auto-created indexes on
SentOn
,RetryCount
, andCreatedOn
.Added dependency injection extensions:
AddMongoMessageStore
AddMongoInboxStore
Extended
IMessageStore
with:UpdateRetryAsync
MoveToDeadLetterAsync
MarkAsSentAsync
Improved observability with structured logging and OpenTelemetry hooks.
---
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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. |
-
net9.0
- Franz.Common.Business (>= 1.6.2)
- Franz.Common.DependencyInjection (>= 1.6.2)
- Franz.Common.EntityFramework (>= 1.6.2)
- Franz.Common.Http.MultiTenancy (>= 1.6.2)
- Franz.Common.Mediator (>= 1.6.2)
- Franz.Common.Messaging (>= 1.6.2)
- MongoDB.Driver (>= 3.4.3)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Franz.Common.MongoDB:
Package | Downloads |
---|---|
Franz.Common.Messaging.EntityFramework
Shared utility library for the Franz Framework. |
|
Franz.Common.Http.EntityFramework
Shared utility library for the Franz Framework. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.6.2 | 0 | 10/7/2025 |
1.5.9 | 164 | 9/24/2025 |
1.5.4 | 160 | 9/23/2025 |
1.5.3 | 210 | 9/21/2025 |
1.5.2 | 213 | 9/21/2025 |
1.5.0 | 205 | 9/21/2025 |
1.4.4 | 179 | 9/20/2025 |
1.3.14 | 294 | 9/18/2025 |
1.3.13 | 278 | 9/18/2025 |
1.3.5 | 290 | 9/17/2025 |
1.3.4 | 302 | 9/16/2025 |
1.3.3 | 291 | 9/16/2025 |
1.3.2 | 281 | 9/15/2025 |
1.3.1 | 95 | 9/12/2025 |
1.3.0 | 313 | 8/25/2025 |
1.2.65 | 178 | 3/3/2025 |
1.2.64 | 132 | 1/29/2025 |
1.2.63 | 118 | 1/27/2025 |
1.2.62 | 126 | 1/8/2025 |