Skip to main content
Published
Apr 8, 2026
6mo ago
Total Downloads
1.5M
1,469,694

Install

dotnet add package Aspire.Hosting.Kafka --version 13.2.2
ProductVersions
.NET
net8.0

README

Aspire.Hosting.Kafka library

Provides extension methods and resource definitions for an Aspire AppHost to configure a Kafka resource.

Getting started

Install the package

In your AppHost project, install the Aspire Kafka Hosting library with NuGet:

dotnet add package Aspire.Hosting.Kafka

Usage example

Then, in the AppHost.cs file of AppHost, add a Kafka resource and consume the connection using the following methods:

var kafka = builder.AddKafka("messaging");

var myService = builder.AddProject<Projects.MyService>()
                       .WithReference(kafka);

Connection Properties

When you reference a Kafka resource using WithReference, the following connection properties are made available to the consuming project:

Kafka server

The Kafka server resource exposes the following connection properties:

Property Name Description
Host The host-facing Kafka listener hostname or IP address
Port The host-facing Kafka listener port

Aspire exposes each property as an environment variable named [RESOURCE]_[PROPERTY]. For instance, the Uri property of a resource called messaging becomes MESSAGING_URI.

Additional documentation

Feedback & contributing

https://github.com/microsoft/aspire

Changes from Previous Version

No structural changes between v13.2.1 and v13.2.2.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 1 target framework; confirm the exact target used by your application.The published metadata declares 29 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.