Anarchy.Toolkit.Testing.Kafka 1.0.0

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

Anarchy.Toolkit.Testing.Kafka

Part of Anarchy I/O Toolkit · Pillar: Infrastructure · Layer: Testing · Package catalog

Helpers for testing Infrastructure.Messaging.Kafka: KafkaMessageFixture.FromOutbound makes a consumed record without a broker, while KafkaTestConsumer reads a real Kafka-compatible broker from the beginning of a specified partition.

using Anarchy.Toolkit.Testing.Kafka.Helper;
using Confluent.Kafka;

// Create a unique topic and publish before reading. Supply your test broker configuration.
using var consumer = new KafkaTestConsumer(new ConsumerConfig {
    BootstrapServers = "localhost:9092", GroupId = Guid.NewGuid().ToString(),
    EnableAutoCommit = false
}, topic);
using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(10));
var message = consumer.Read(timeout.Token);

The helper does not provision or clean up topics, explicitly commit offsets, or start a broker. Disable auto commit, use isolated topics and configure the broker separately. A fixture is useful for unit tests but is not a substitute for a real-broker integration test.

Releases

See the release notes for the complete release history.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 46 11/24/2026

## Releases

### 1.0.0

- Introduced a Kafka record fixture and real-broker test consumer.