Franz.Common.Messaging
2.2.16
dotnet add package Franz.Common.Messaging --version 2.2.16
NuGet\Install-Package Franz.Common.Messaging -Version 2.2.16
<PackageReference Include="Franz.Common.Messaging" Version="2.2.16" />
<PackageVersion Include="Franz.Common.Messaging" Version="2.2.16" />Directory.Packages.props
<PackageReference Include="Franz.Common.Messaging" />Project file
paket add Franz.Common.Messaging --version 2.2.16
#r "nuget: Franz.Common.Messaging, 2.2.16"
#:package Franz.Common.Messaging@2.2.16
#addin nuget:?package=Franz.Common.Messaging&version=2.2.16Install as a Cake Addin
#tool nuget:?package=Franz.Common.Messaging&version=2.2.16Install as a Cake Tool
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: v2.2.16
- 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.
Version 1.6.20
- Updated to .NET 10.0
v2.0.1 β Internal Modernization
- Messaging and infrastructure refactored for async, thread-safety, and modern .NET 10 patterns.
- All APIs remain fully backward compatible.
- Tests, listeners, and pipeline components modernized.
| 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. |
-
net10.0
- Franz.Common.Business (>= 2.2.16)
- Franz.Common.DependencyInjection (>= 2.2.16)
- Franz.Common.Errors (>= 2.2.16)
- Franz.Common.Headers (>= 2.2.16)
- Franz.Common.Serialization (>= 2.2.16)
- Microsoft.Extensions.Options (>= 10.0.9)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.9)
- Microsoft.Extensions.Primitives (>= 10.0.9)
NuGet packages (13)
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 |
|---|---|---|
| 2.2.16 | 65 | 7/2/2026 |
| 2.2.15 | 262 | 6/29/2026 |
| 2.2.14 | 268 | 6/29/2026 |
| 2.2.13 | 268 | 6/29/2026 |
| 2.2.12 | 278 | 6/28/2026 |
| 2.2.11 | 294 | 6/28/2026 |
| 2.2.10 | 284 | 6/28/2026 |
| 2.2.9 | 281 | 6/28/2026 |
| 2.2.8 | 278 | 6/28/2026 |
| 2.2.7 | 292 | 6/7/2026 |
| 2.2.6 | 293 | 6/6/2026 |
| 2.2.5 | 387 | 6/4/2026 |
| 2.2.4 | 390 | 6/3/2026 |
| 2.2.3 | 378 | 6/2/2026 |
| 2.2.2 | 385 | 6/2/2026 |
| 2.2.1 | 383 | 5/24/2026 |
| 2.1.4 | 337 | 4/27/2026 |
| 2.1.3 | 325 | 4/26/2026 |
| 2.1.2 | 325 | 4/26/2026 |
| 2.1.1 | 252 | 4/22/2026 |