Franz.Common.Messaging
1.6.19
dotnet add package Franz.Common.Messaging --version 1.6.19
NuGet\Install-Package Franz.Common.Messaging -Version 1.6.19
<PackageReference Include="Franz.Common.Messaging" Version="1.6.19" />
<PackageVersion Include="Franz.Common.Messaging" Version="1.6.19" />
<PackageReference Include="Franz.Common.Messaging" />
paket add Franz.Common.Messaging --version 1.6.19
#r "nuget: Franz.Common.Messaging, 1.6.19"
#:package Franz.Common.Messaging@1.6.19
#addin nuget:?package=Franz.Common.Messaging&version=1.6.19
#tool nuget:?package=Franz.Common.Messaging&version=1.6.19
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
IMessageSerializercontract. - 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
IListenerinterface. - Dedicated listeners:
KafkaListener(transport-only)OutboxListener(transport-only)
- Hosted service wrappers:
KafkaHostedServiceOutboxHostedService
- Clean separation of transport vs hosting concerns.
- Transport-agnostic
⚡ MongoDB Integration
MongoMessageStorewith automatic index creation:SentOnRetryCountCreatedOn
MongoInboxStorewith 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
IMessageStoreandIInboxStore.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.19
- 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.19)
- Franz.Common.DependencyInjection (>= 1.6.19)
- Franz.Common.Errors (>= 1.6.19)
- Franz.Common.Headers (>= 1.6.19)
- 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.19 | 77 | 10/25/2025 |
| 1.6.15 | 305 | 10/20/2025 |
| 1.6.14 | 303 | 10/15/2025 |
| 1.6.3 | 306 | 10/9/2025 |
| 1.6.2 | 321 | 10/7/2025 |
| 1.5.9 | 279 | 9/24/2025 |
| 1.5.4 | 251 | 9/23/2025 |
| 1.5.3 | 302 | 9/21/2025 |
| 1.5.2 | 309 | 9/21/2025 |
| 1.5.0 | 292 | 9/21/2025 |
| 1.4.4 | 277 | 9/20/2025 |
| 1.3.14 | 375 | 9/18/2025 |
| 1.3.13 | 368 | 9/18/2025 |
| 1.3.5 | 377 | 9/17/2025 |
| 1.3.4 | 363 | 9/16/2025 |
| 1.3.3 | 348 | 9/16/2025 |
| 1.3.2 | 344 | 9/15/2025 |
| 1.3.1 | 157 | 9/12/2025 |
| 1.3.0 | 357 | 8/25/2025 |
| 1.2.65 | 267 | 3/3/2025 |
| 1.2.64 | 210 | 1/29/2025 |
| 1.2.63 | 232 | 1/27/2025 |
| 1.2.62 | 245 | 1/8/2025 |