Franz.Common.Messaging.Hosting 1.6.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Franz.Common.Messaging.Hosting --version 1.6.2
                    
NuGet\Install-Package Franz.Common.Messaging.Hosting -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.Hosting" 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.Hosting" Version="1.6.2" />
                    
Directory.Packages.props
<PackageReference Include="Franz.Common.Messaging.Hosting" />
                    
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.Hosting --version 1.6.2
                    
#r "nuget: Franz.Common.Messaging.Hosting, 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.Hosting@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.Hosting&version=1.6.2
                    
Install as a Cake Addin
#tool nuget:?package=Franz.Common.Messaging.Hosting&version=1.6.2
                    
Install as a Cake Tool

Franz.Common.Messaging.Hosting

A foundational library within the Franz Framework designed to enable and manage hosted messaging services in distributed applications.
This package provides hosting utilities, message execution strategies, delegation, transaction management, and seamless integration with Microsoft.Extensions.Hosting.


✨ Features

  • Hosted Messaging Services

    • MessagingHostedService for orchestrating background message processing.
    • Wrapper services for Kafka and Outbox listeners (KafkaHostedService, OutboxHostedService).
  • Message Context Management

    • MessageContextAccessor manages per-message context during execution.
    • Async-local storage ensures safe context propagation across async flows.
  • Delegating Message Actions

    • IAsyncMessageActionFilter and MessageActionExecutionDelegate let you extend/control pipelines before/after handling.
  • Transaction Management

    • TransactionFilter ensures consistency across message processing and persistence.
  • Messaging Execution Strategies

    • IMessagingStrategyExecuter defines custom strategies for message execution.
  • 📥 Inbox Pattern Integration

    • Built-in IInboxStore support for idempotent message consumption.
    • Ensures "exactly-once" processing even under retries or replays.
  • 📦 Outbox Pattern Integration

    • Hosted service wrappers for OutboxMessageListener to continuously publish pending messages.
  • Extensions

    • HostBuilderExtensions for wiring messaging services into the host builder.
    • ServiceCollectionExtensions for DI registration.
  • Observability

    • Structured logging with emoji-friendly conventions (✅ success, ⚠️ retries, 🔥 DLQ).
    • OpenTelemetry hooks for distributed tracing.

📂 Project Structure


Franz.Common.Messaging.Hosting/
├── Context/
│    └── MessageContextAccessor.cs
├── Delegating/
│    └── IAsyncMessageActionFilter.cs
├── Executing/
│    └── IMessagingStrategyExecuter.cs
├── HostedServices/
│    ├── MessagingHostedService.cs
│    ├── KafkaHostedService.cs
│    └── OutboxHostedService.cs
├── Transactions/
│    └── TransactionFilter.cs
└── Extensions/
└── HostBuilderExtensions.cs


⚙️ Dependencies

  • Microsoft.Extensions.DependencyInjection.Abstractions (8.0.0)
  • Microsoft.Extensions.Hosting (8.0.0)
  • Franz.Common.Hosting – general hosting utilities
  • Franz.Common.Logging – centralized structured logging
  • Franz.Common.Messaging – core messaging abstractions

🚀 Usage

1. Register Messaging Hosted Services

using Franz.Common.Messaging.Hosting.Extensions;

var host = Host.CreateDefaultBuilder(args)
    .AddMessagingHostedService()
    .AddKafkaHostedListener()
    .AddOutboxHostedListener()
    .Build();

await host.RunAsync();

2. Customize Messaging Actions

public class CustomMessageActionFilter : IAsyncMessageActionFilter
{
    public async Task OnMessageExecutingAsync(MessageActionExecutingContext context)
    {
        Console.WriteLine("🚦 Before message execution");
    }

    public async Task OnMessageExecutedAsync(MessageActionExecutedContext context)
    {
        Console.WriteLine("✅ After message execution");
    }
}

3. Transaction Management

services.AddControllers(options =>
{
    options.Filters.Add<TransactionFilter>();
});

4. Implement Messaging Strategies

public class CustomMessagingStrategyExecuter : IMessagingStrategyExecuter
{
    public async Task ExecuteAsync(MessageContext context)
    {
        // Custom execution logic
    }
}

📊 Observability

  • Emoji-based structured logs (✅ success, ⚠️ retry, 🔥 DLQ, 💤 idle).
  • Tracing via OpenTelemetry spans for Kafka + Outbox messages.

📝 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 to .NET 9.

Version 1.3

  • Upgraded to .NET 9.0.8.
  • Added new features and improvements.
  • Separated business concepts from mediator concepts.
  • Compatibility with both the in-house mediator and MediatR.

Version 1.6.2

  • Introduced KafkaHostedService and OutboxHostedService for clean separation of concerns.

  • Added Inbox pattern integration (IInboxStore) with hosted listener support.

  • Extended MessageContextAccessor with AsyncLocal for per-message scoping.

  • Unified listener abstractions (IListener) with async cancellation token support.

  • Introduced consistent DI extensions:

    • AddKafkaHostedListener()
    • AddOutboxHostedListener()
  • Enhanced structured logging with emoji conventions for observability.

  • Added OpenTelemetry hooks for distributed tracing of message processing.

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 (8)

Showing the top 5 NuGet packages that depend on Franz.Common.Messaging.Hosting:

Package Downloads
Franz.Common.Messaging.Kafka

Shared utility library for the Franz Framework.

Franz.Common.Messaging.EntityFramework

Shared utility library for the Franz Framework.

Franz.Common.Messaging.Bootstrap

Shared utility library for the Franz Framework.

Franz.Common.Messaging.Hosting.MediatR

Shared utility library for the Franz Framework.

Franz.Common.Messaging.Hosting.Mediator

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.3 0 10/9/2025
1.6.2 58 10/7/2025
1.5.9 212 9/24/2025
1.5.4 220 9/23/2025
1.5.3 266 9/21/2025
1.5.2 264 9/21/2025
1.5.0 239 9/21/2025
1.4.4 238 9/20/2025
1.3.14 341 9/18/2025
1.3.13 346 9/18/2025
1.3.5 332 9/17/2025
1.3.4 342 9/16/2025
1.3.3 333 9/16/2025
1.3.2 320 9/15/2025
1.3.1 140 9/12/2025
1.3.0 340 8/25/2025
1.2.65 248 3/3/2025
1.2.64 174 1/29/2025
1.2.63 186 1/27/2025
1.2.62 197 1/8/2025