Shirubasoft.Aspire.Extensions.Kafka 1.2.0

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

Shirubasoft.Aspire.Extensions.Kafka

Add a Confluent Schema Registry container and idempotently register Kafka topics in an Aspire AppHost.

Install

Add the package to an Aspire AppHost that already uses Aspire.Hosting.Kafka:

dotnet add package Shirubasoft.Aspire.Extensions.Kafka

The package targets .NET 10 and Aspire 13.5.3 or later within the Aspire 13.5 line.

Add Schema Registry and topics

using Aspire.Hosting;

var builder = DistributedApplication.CreateBuilder(args);

var kafka = builder.AddKafka("kafka");
var schemaRegistry = kafka.AddSchemaRegistry("schema-registry");
var orders = kafka.AddTopic("orders", partitionCount: 3);

builder.AddProject<Projects.Worker>("worker")
    .WithReference(kafka)
    .WithReference(schemaRegistry)
    .WaitFor(schemaRegistry)
    .WaitFor(orders);

await builder.Build().RunAsync();

AddSchemaRegistry runs confluentinc/cp-schema-registry:8.1.0, waits for Kafka, and reports healthy after GET /subjects succeeds. Pass port to bind a fixed host port. Standard container builder methods can replace the image or add persistent configuration.

The Schema Registry WithReference overload injects all of these values into the destination:

Variable Value
ConnectionStrings__schema-registry The full HTTP address.
SCHEMA_REGISTRY_HTTP The context-aware HTTP endpoint.
services__schema-registry__http__0 The .NET service-discovery endpoint.
SCHEMA_REGISTRY_ADDRESS The full HTTP address as a connection property.
SCHEMA_REGISTRY_HOST The resolved Schema Registry host.
SCHEMA_REGISTRY_PORT The resolved Schema Registry port.

Use a custom connection name when the consumer expects another configuration key:

worker.WithReference(schemaRegistry, connectionName: "schemas");

This writes ConnectionStrings__schemas and SCHEMAS_ADDRESS. Endpoint variables keep the Schema Registry resource name.

AddTopic waits for the broker, calls Kafka's admin API, and treats an existing topic as success. A dependent resource can call WaitFor(topic) and starts only after registration succeeds. partitionCount and replicationFactor apply only when Kafka creates the topic.

Run the sample

From this extension folder, run:

aspire run --project samples/Kafka.AppHost/Kafka.AppHost.csproj

The dashboard shows Kafka, Schema Registry, the registered orders topic, and a consumer container with the injected references.

Package contents

The NuGet package includes the assembly, XML API documentation, this README, repository metadata, Source Link data, and a matching .snupkg symbol package.

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.2.0 104 9/6/2026
1.1.0 112 9/2/2026
1.0.0 99 8/31/2026