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
                    
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="Franz.Common.Messaging" Version="1.6.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Franz.Common.Messaging" Version="1.6.2" />
                    
Directory.Packages.props
<PackageReference Include="Franz.Common.Messaging" />
                    
Project file
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 Franz.Common.Messaging --version 1.6.2
                    
#r "nuget: Franz.Common.Messaging, 1.6.2"
                    
#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 Franz.Common.Messaging@1.6.2
                    
#: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=Franz.Common.Messaging&version=1.6.2
                    
Install as a Cake Addin
#tool nuget:?package=Franz.Common.Messaging&version=1.6.2
                    
Install 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).
  • 📥 Inbox Pattern

    • Prevents duplicate processing with IInboxStore.
    • MongoDB-backed implementation (MongoInboxStore).
    • Guarantees idempotency under retries or replays.
  • 🧩 Serializer Abstraction

    • Unified IMessageSerializer contract.
    • Default JsonMessageSerializer (camelCase, ignore nulls).
    • Shared across Kafka, Mongo, and Outbox.
  • 📊 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.
  • ⚡ 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.KafkaKafkaHostedService.
  • Franz.Common.Messaging.Hosting.MongoOutboxHostedService, 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

  1. Send Command/Event → via IMessagingSender.
  2. Persist in OutboxMongoMessageStore.
  3. Publisher Service → retries + DLQ if needed.
  4. Transport → Kafka.
  5. Listener → consumes message.
  6. Inbox Check → skip if already processed.
  7. DispatcherSendAsync (command) / PublishAsync (event).

🚀 Extensibility

  • Add new transports (RabbitMQ, Azure Service Bus, etc.):

    • Implement IListener + HostedService in Hosting.[Transport].
    • Add DI registration extensions.
  • Swap Mongo for SQL by implementing IMessageStore and IInboxStore.

  • 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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