Franz.Common.Annotations 1.2.62

dotnet add package Franz.Common.Annotations --version 1.2.62                
NuGet\Install-Package Franz.Common.Annotations -Version 1.2.62                
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.Annotations" Version="1.2.62" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Franz.Common.Annotations --version 1.2.62                
#r "nuget: Franz.Common.Annotations, 1.2.62"                
#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.
// Install Franz.Common.Annotations as a Cake Addin
#addin nuget:?package=Franz.Common.Annotations&version=1.2.62

// Install Franz.Common.Annotations as a Cake Tool
#tool nuget:?package=Franz.Common.Annotations&version=1.2.62                

Franz.Common.Annotations

A lightweight library within the Franz Framework designed to provide custom attribute-based annotations for simplifying Kafka topic validation in .NET applications.


Features

  • Custom Kafka Topic Annotation:
    • RequiredKafkaTopicAttribute: Ensures that a Kafka topic is specified and validated for producer/consumer configurations.

Version Information

  • Current Version: 1.2.62
  • Part of the private Franz Framework ecosystem.

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.Annotations --version 1.2.62

Usage

1. Apply RequiredKafkaTopicAttribute

Use the RequiredKafkaTopicAttribute to annotate properties or fields that represent Kafka topics in your application. This ensures that all required topics are explicitly defined and validated at runtime.

Example:

using Franz.Common.Annotations;

public class KafkaConfiguration
{
    [RequiredKafkaTopic]
    public string OrdersTopic { get; set; }

    [RequiredKafkaTopic]
    public string PaymentsTopic { get; set; }
}

2. Validation

Ensure that annotated properties are checked during application initialization:

var kafkaConfig = new KafkaConfiguration
{
    OrdersTopic = "orders",
    PaymentsTopic = string.Empty // Validation will fail here
};

ValidateKafkaConfiguration(kafkaConfig);

void ValidateKafkaConfiguration(object config)
{
    var properties = config.GetType().GetProperties();

    foreach (var property in properties)
    {
        var attribute = property.GetCustomAttribute<RequiredKafkaTopicAttribute>();
        if (attribute != null && string.IsNullOrWhiteSpace(property.GetValue(config)?.ToString()))
        {
            throw new InvalidOperationException($"The Kafka topic '{property.Name}' is required but was not provided.");
        }
    }
}

Dependencies

This package has no external dependencies but integrates seamlessly with other Franz Framework libraries.


Contributing

This package is part of a private framework. Contributions are limited to the internal development team. If you have access, follow these steps:

  1. Clone the repository.
  2. Create a feature branch.
  3. 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

  • Introduced RequiredKafkaTopicAttribute for Kafka topic validation.
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Franz.Common.Annotations:

Package Downloads
Franz.Common.Messaging.Kafka

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 50 1/8/2025