Franz.Common.Messaging.Hosting
1.6.2
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
<PackageReference Include="Franz.Common.Messaging.Hosting" Version="1.6.2" />
<PackageVersion Include="Franz.Common.Messaging.Hosting" Version="1.6.2" />
<PackageReference Include="Franz.Common.Messaging.Hosting" />
paket add Franz.Common.Messaging.Hosting --version 1.6.2
#r "nuget: Franz.Common.Messaging.Hosting, 1.6.2"
#:package Franz.Common.Messaging.Hosting@1.6.2
#addin nuget:?package=Franz.Common.Messaging.Hosting&version=1.6.2
#tool nuget:?package=Franz.Common.Messaging.Hosting&version=1.6.2
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
andMessageActionExecutionDelegate
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.
- Built-in
📦 Outbox Pattern Integration
- Hosted service wrappers for
OutboxMessageListener
to continuously publish pending messages.
- Hosted service wrappers for
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 | 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
- Confluent.Kafka (>= 2.11.1)
- Franz.Common.Hosting (>= 1.6.2)
- Franz.Common.Logging (>= 1.6.2)
- Franz.Common.Messaging (>= 1.6.2)
- Franz.Common.Serialization (>= 1.6.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Hosting (>= 9.0.8)
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 |