Franz.Common.Messaging
1.6.2
dotnet add package Franz.Common.Messaging --version 1.6.2
NuGet\Install-Package Franz.Common.Messaging -Version 1.6.2
<PackageReference Include="Franz.Common.Messaging" Version="1.6.2" />
<PackageVersion Include="Franz.Common.Messaging" Version="1.6.2" />
<PackageReference Include="Franz.Common.Messaging" />
paket add Franz.Common.Messaging --version 1.6.2
#r "nuget: Franz.Common.Messaging, 1.6.2"
#:package Franz.Common.Messaging@1.6.2
#addin nuget:?package=Franz.Common.Messaging&version=1.6.2
#tool nuget:?package=Franz.Common.Messaging&version=1.6.2
Franz.Common.Messaging
A messaging abstraction library within the Franz Framework that provides a unified foundation for building reliable, resilient, and extensible distributed messaging systems.
It supports outbox, inbox, retries, dead-letter queues, and multiple transports (starting with Kafka and MongoDB).
✨ Features
📦 Outbox Pattern
- Reliable delivery with
OutboxPublisherService
. - Retries with exponential backoff.
- Moves failed messages to a Dead Letter Queue (DLQ) after max retries.
- MongoDB-backed implementation (
MongoMessageStore
).
- Reliable delivery with
📥 Inbox Pattern
- Prevents duplicate processing with
IInboxStore
. - MongoDB-backed implementation (
MongoInboxStore
). - Guarantees idempotency under retries or replays.
- Prevents duplicate processing with
🧩 Serializer Abstraction
- Unified
IMessageSerializer
contract. - Default
JsonMessageSerializer
(camelCase, ignore nulls). - Shared across Kafka, Mongo, and Outbox.
- Unified
📊 Observability & Monitoring
- Structured logging (with emojis ✅⚠️🔥).
- OpenTelemetry-friendly hooks.
- Covers retries, DLQ moves, dispatch, and consumption.
🎧 Listeners & Hosting
- Transport-agnostic
IListener
interface. - Dedicated listeners:
KafkaListener
(transport-only)OutboxListener
(transport-only)
- Hosted service wrappers:
KafkaHostedService
OutboxHostedService
- Clean separation of transport vs hosting concerns.
- Transport-agnostic
⚡ MongoDB Integration
MongoMessageStore
with automatic index creation:SentOn
RetryCount
CreatedOn
MongoInboxStore
with unique index on message IDs.- DI extensions:
AddMongoMessageStore
,AddMongoInboxStore
.
📂 Project Structure
Franz.Common.Messaging/
├── Configuration/
├── Contexting/
├── Delegating/
├── Extensions/
├── Factories/
├── Headers/
├── Outboxes/
│ ├── OutboxOptions.cs
│ ├── OutboxPublisherService.cs
│ └── ServiceCollectionExtensions.cs
├── Serialization/
│ ├── ISerializer.cs
│ ├── JsonMessageSerializer.cs
│ └── ServiceCollectionExtensions.cs
├── Storage/
│ ├── InboxStore.cs
│ ├── IMessageStore.cs
│ ├── StoredMessage.cs
│ ├── Mappings/MessageMappingExtensions.cs
│ └── …
├── Message.cs
├── IMessageSender.cs
└── …
Hosting-specific projects:
- Franz.Common.Messaging.Hosting → defines
IListener
,MessageContext
, base services. - Franz.Common.Messaging.Hosting.Kafka →
KafkaHostedService
. - Franz.Common.Messaging.Hosting.Mongo →
OutboxHostedService
,InboxHostedService
.
⚙️ Configuration
MessagingOptions
in appsettings.json
:
"Messaging": {
"BootstrapServers": "localhost:9092",
"GroupId": "my-service",
"OutboxCollection": "OutboxMessages",
"DeadLetterCollection": "DeadLetterMessages",
"InboxCollection": "InboxMessages"
}
⚡ Dependency Injection Setup
builder.Services.AddMessagingCore();
builder.Services.AddMongoMessageStore(configuration);
builder.Services.AddMongoInboxStore(configuration);
builder.Services.AddKafkaHostedListener();
builder.Services.AddOutboxHostedListener();
🔄 Typical Flow
- Send Command/Event → via
IMessagingSender
. - Persist in Outbox →
MongoMessageStore
. - Publisher Service → retries + DLQ if needed.
- Transport → Kafka.
- Listener → consumes message.
- Inbox Check → skip if already processed.
- Dispatcher →
SendAsync
(command) /PublishAsync
(event).
🚀 Extensibility
Add new transports (RabbitMQ, Azure Service Bus, etc.):
- Implement
IListener
+ HostedService inHosting.[Transport]
. - Add DI registration extensions.
- Implement
Swap Mongo for SQL by implementing
IMessageStore
andIInboxStore
.Replace JSON with custom serializers via
IMessageSerializer
.
📊 Observability
Emoji-style structured logs for clarity:
- ✅ Success
- ⚠️ Retry
- 🔁 Skipped (Inbox)
- 🔥 Dead Letter
Compatible with OpenTelemetry for tracing message lifecycles.
📌 Roadmap
- Batch consumption support.
- Message expiration / cleanup.
- RabbitMQ transport (
Franz.Common.Messaging.Hosting.RabbitMq
).
📝 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
- Upgrade version to .net 9
### 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.3.6
- Integrated with Franz.Mediator (no MediatR).
- MessagingPublisher.Publish is now async Task.
- MessagingInitializer scans INotificationHandler<> for events.
- Kafka topics auto-created for all integration events.
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.Errors (>= 1.6.2)
- Franz.Common.Headers (>= 1.6.2)
- Microsoft.Extensions.Options (>= 9.0.8)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.8)
- Microsoft.Extensions.Primitives (>= 9.0.8)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (9)
Showing the top 5 NuGet packages that depend on Franz.Common.Messaging:
Package | Downloads |
---|---|
Franz.Common.Messaging.Hosting
Shared utility library for the Franz Framework. |
|
Franz.Common.Messaging.Kafka
Shared utility library for the Franz Framework. |
|
Franz.Common.Messaging.Identity
Shared utility library for the Franz Framework. |
|
Franz.Common.Messaging.MultiTenancy
Shared utility library for the Franz Framework. |
|
Franz.Common.MongoDB
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 | 270 | 9/24/2025 |
1.5.4 | 243 | 9/23/2025 |
1.5.3 | 300 | 9/21/2025 |
1.5.2 | 298 | 9/21/2025 |
1.5.0 | 288 | 9/21/2025 |
1.4.4 | 271 | 9/20/2025 |
1.3.14 | 371 | 9/18/2025 |
1.3.13 | 363 | 9/18/2025 |
1.3.5 | 376 | 9/17/2025 |
1.3.4 | 358 | 9/16/2025 |
1.3.3 | 345 | 9/16/2025 |
1.3.2 | 341 | 9/15/2025 |
1.3.1 | 150 | 9/12/2025 |
1.3.0 | 355 | 8/25/2025 |
1.2.65 | 264 | 3/3/2025 |
1.2.64 | 207 | 1/29/2025 |
1.2.63 | 227 | 1/27/2025 |
1.2.62 | 242 | 1/8/2025 |