# AddKafka

- Module: [Aspire.Hosting.Kafka](/reference/api/go/aspire.hosting.kafka.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: `DistributedApplicationBuilder`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Adds a Kafka resource to the application. A container is used for local development.

## Remarks

This version of the package defaults to the tag of the container image.

## Definition

```go
func (DistributedApplicationBuilder) AddKafka(
    name string,
    options ...*AddKafkaOptions,
) KafkaServerResource
```

## Parameters

- `name` (`string`) -- The name of the resource. This name will be used as the connection string name when referenced in a dependency
- `options` (`...*AddKafkaOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*AddKafkaOptions` argument.

- `Port` (`*float64`) -- The host port of Kafka broker.

## Returns

[`KafkaServerResource`](/reference/api/go/aspire.hosting.kafka/kafkaserverresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Applies to

- `DistributedApplicationBuilder`
