Franz.Common.Messaging
1.2.62
dotnet add package Franz.Common.Messaging --version 1.2.62
NuGet\Install-Package Franz.Common.Messaging -Version 1.2.62
<PackageReference Include="Franz.Common.Messaging" Version="1.2.62" />
paket add Franz.Common.Messaging --version 1.2.62
#r "nuget: Franz.Common.Messaging, 1.2.62"
// Install Franz.Common.Messaging as a Cake Addin #addin nuget:?package=Franz.Common.Messaging&version=1.2.62 // Install Franz.Common.Messaging as a Cake Tool #tool nuget:?package=Franz.Common.Messaging&version=1.2.62
Franz.Common.Messaging
A messaging abstraction library within the Franz Framework that simplifies the handling of messages, headers, and events for distributed systems. This package provides a comprehensive set of tools to build, send, and manage messages, with strong support for context propagation, delegation, and customizable strategies.
Features
- Messaging Context Management:
- Interfaces like
IMessageContext
andIMessageContextAccessor
for managing message-specific data. MessageContext
for centralized context handling.
- Interfaces like
- Delegating Handlers:
MessageBuilderDelegatingHandler
to extend messaging pipelines.
- Factories:
MessageFactory
and builder strategies (CommandMessageBuilderStrategy
,IntegrationEventMessageBuilderStrategy
) for consistent message construction.
- Headers:
- Tools like
HeaderContextAccessor
,HeaderNamer
, andMessageHeaders
to manage and propagate headers.
- Tools like
- Messaging Lifecycle:
- Interfaces for key messaging operations, such as:
IMessagingInitializer
IMessagingPublisher
IMessagingSender
IMessagingTransaction
- Interfaces for key messaging operations, such as:
- Constants and Utilities:
- Includes
MessagingConstants
and helper classes for common messaging patterns.
- Includes
- Dependency Injection:
ServiceCollectionExtensions
for streamlined registration of messaging-related services.
Version Information
- Current Version: 1.2.62
- Part of the private Franz Framework ecosystem.
Dependencies
This package relies on:
- Microsoft.Extensions.Options (8.0.0): Provides options pattern for configurations.
- Microsoft.Extensions.Options.ConfigurationExtensions (8.0.0): Extends options for configuration binding.
- Microsoft.Extensions.Primitives (8.0.0): Supports header and data propagation.
- Newtonsoft.Json (13.0.3): For serialization of message payloads.
- Franz.Common.Business: Provides core business utilities.
- Franz.Common.DependencyInjection: Simplifies dependency injection.
- Franz.Common.Errors: For error handling in messaging workflows.
- Franz.Common.Headers: Enhances header handling.
Installation
From Private Azure Feed
Since this package is hosted privately, configure your NuGet client:
dotnet nuget add source "https://your-private-feed-url" \
--name "AzurePrivateFeed" \
--username "YourAzureUsername" \
--password "YourAzurePassword" \
--store-password-in-clear-text
Install the package:
dotnet add package Franz.Common.Messaging --version 1.2.62
Usage
1. Configure Messaging Options
Use MessagingOptions
to configure messaging behavior:
using Franz.Common.Messaging.Configuration;
services.Configure<MessagingOptions>(options =>
{
options.DefaultExchange = "my-default-exchange";
});
2. Build and Send Messages
Leverage MessageFactory
and IMessagingSender
to build and send messages:
using Franz.Common.Messaging.Factories;
var messageFactory = new MessageFactory();
var message = messageFactory.CreateMessage("my-event", new { Key = "Value" });
await messagingSender.SendAsync(message);
3. Use Context Accessors
Access messaging context and headers using MessageContext
:
using Franz.Common.Messaging.Contexting;
public class MyService
{
private readonly IMessageContextAccessor _messageContextAccessor;
public MyService(IMessageContextAccessor messageContextAccessor)
{
_messageContextAccessor = messageContextAccessor;
}
public string GetHeaderValue(string headerKey)
{
return _messageContextAccessor.MessageContext.Headers[headerKey];
}
}
4. Propagate Headers
Use HeaderPropagationMessageBuilder
to ensure headers are propagated in distributed messaging:
using Franz.Common.Messaging.Headers;
var headers = new MessageHeaders();
headers.Add("CorrelationId", Guid.NewGuid().ToString());
var messageBuilder = new HeaderPropagationMessageBuilder(headers);
Integration with Franz Framework
The Franz.Common.Messaging package integrates seamlessly with:
- Franz.Common.Business: Provides foundational utilities for business logic.
- Franz.Common.Headers: Simplifies header propagation.
- Franz.Common.DependencyInjection: Enables streamlined dependency injection for messaging services.
Contributing
This package is part of a private framework. Contributions are limited to the internal development team. If you have access, follow these steps:
- Clone the repository.
- Create a feature branch.
- Submit a pull request for review.
License
This library is licensed under the MIT License. See the LICENSE
file for more details.
Changelog
Version 1.2.62
- Added
MessageContext
andIMessageContextAccessor
for centralized message data management. - Introduced
MessageFactory
with builder strategies for consistent message creation. - Integrated
HeaderPropagationMessageBuilder
for header propagation. - Full compatibility with Franz.Common.Business and Franz.Common.Headers.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
-
net8.0
- Azure.Messaging.EventGrid (>= 4.21.0)
- Franz.Common.Business (>= 1.2.62)
- Franz.Common.DependencyInjection (>= 1.2.62)
- Franz.Common.Errors (>= 1.2.62)
- Franz.Common.Headers (>= 1.2.62)
- Microsoft.Extensions.Options (>= 8.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Microsoft.Extensions.Primitives (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (5)
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.Identity
Shared utility library for the Franz Framework. |
|
Franz.Common.Messaging.Kafka
Shared utility library for the Franz Framework. |
|
Franz.Common.Http.Messaging
Shared utility library for the Franz Framework. |
|
Franz.Common.Messaging.MultiTenancy
Shared utility library for the Franz Framework. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.62 | 98 | 1/8/2025 |