Nandel.Kafka.Outbox 1.0.0-alpha.1

This is a prerelease version of Nandel.Kafka.Outbox.
dotnet add package Nandel.Kafka.Outbox --version 1.0.0-alpha.1
                    
NuGet\Install-Package Nandel.Kafka.Outbox -Version 1.0.0-alpha.1
                    
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="Nandel.Kafka.Outbox" Version="1.0.0-alpha.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nandel.Kafka.Outbox" Version="1.0.0-alpha.1" />
                    
Directory.Packages.props
<PackageReference Include="Nandel.Kafka.Outbox" />
                    
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 Nandel.Kafka.Outbox --version 1.0.0-alpha.1
                    
#r "nuget: Nandel.Kafka.Outbox, 1.0.0-alpha.1"
                    
#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 Nandel.Kafka.Outbox@1.0.0-alpha.1
                    
#: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=Nandel.Kafka.Outbox&version=1.0.0-alpha.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Nandel.Kafka.Outbox&version=1.0.0-alpha.1&prerelease
                    
Install as a Cake Tool

Nandel.Kafka

A Kafka Publisher and Consumer Library

How to Use

Consumers should implement the interface IMessageHandler<TMessage> where TMessage is a class that represents your message body.

using Nandel.Kafka.Contracts;

[MessageTopic(TopicName)]
public class Message
{
    public const string TopicName = "benchs.throughput.message";

    [JsonPropertyName("value")] public Guid Value { get; set; }
}

[MessageConsumer(Message.TopicName, "benchs.throughput.consumer")]
public class Consumer(ILogger<Consumer> logger) : IMessageHandler<Message>
{
    public Task HandleAsync(IMessageEnvelope<Message> envelope, Message message, CancellationToken cancel)
    {
        logger.LogInformation("Message Consumed");
        return Task.CompletedTask;
    }
}

You can publish your messages too using the service IMessagePublisher, this interface is able to publish all messages types.

public class Producer(IMessagePublisher publisher)
{
    public async Task PublishMessageAsync(CancellationToken cancel)
    {
        var message = new Message { Value = Guid.NewGuid() };
        await publisher.PublishAsync(message.Value.ToString(), message, cancel);
    }
}

Setting up your project to work with Nandel.Kafka you need first to install it through the command dotnet add package Nandel.Kafka, after that you will need register the library services in your dependency injection system using the new method AddNandelKafka available as an extension of IServiceCollection.

For each implementation of IMessageHandler<T> you need to setup a consumer to start adding it to your dependency injection container using the extension .AddMessageConsumer<TMessage, TConsumer>().

IServiceCollection services;
services.AddNandelKafka(builder.Configuration.GetSection("Kafka")); // this configures Nandel.Kafka
services.AddKafkaMessageConsumer<Message, Consumer>(); // this setups a consumer to start

Benchmark Results

ThroughputBenchmark

Execution Length (seconds): 300
Messages produced: 1599532
Messages consumed: 1599532
Messages per second: 4,669.84
:
OS: Microsoft Windows NT 10.0.26100.0; 64-bit:True
Number of logical processors: 8
.NET version: 9.0.6
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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.1 123 9/26/2025