# KafkaServerResource

- Module: [Aspire.Hosting.Kafka](/reference/api/go/aspire.hosting.kafka.md)
- Version: `17.0.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

A resource that represents a Kafka broker.

## Definition

```go
type KafkaServerResource interface {
    ExpressionValue
    IComputeResource
    Resource
    ResourceWithArgs
    ResourceWithConnectionString
    ResourceWithEndpoints
    ResourceWithEnvironment
    ResourceWithWaitSupport
}
```

## Embeds

- `ExpressionValue`
- `IComputeResource`
- `Resource`
- `ResourceWithArgs`
- `ResourceWithConnectionString`
- `ResourceWithEndpoints`
- `ResourceWithEnvironment`
- `ResourceWithWaitSupport`

## Properties

- `ConnectionStringExpression`: `*ReferenceExpression` `get` -- Gets the connection string expression for the Kafka broker.
- `Host`: `EndpointReferenceExpression` `get` -- Gets the host endpoint reference for the primary endpoint.
- `InternalEndpoint`: `EndpointReference` `get` -- Gets the internal endpoint for the Kafka broker. This endpoint is used for container to broker communication. To connect to the Kafka broker from a host process, use `PrimaryEndpoint`.
- `Port`: `EndpointReferenceExpression` `get` -- Gets the port endpoint reference for the primary endpoint.
- `PrimaryEndpoint`: `EndpointReference` `get` -- Gets the primary endpoint for the Kafka broker. This endpoint is used for host processes to Kafka broker communication. To connect to the Kafka broker from a container, use `InternalEndpoint`.
- `ResourceTypeDisplayName`: `string` `get` -- Gets the ResourceTypeDisplayName property

## Methods

- [WithDataBindMount](/reference/api/go/aspire.hosting.kafka/kafkaserverresource/withdatabindmount.md) -- `method` -- Adds a bind mount for the data folder to a Kafka container resource.
  ```go
  WithDataBindMount(source string, options ...*WithDataBindMountOptions) KafkaServerResource
  ```
- [WithDataVolume](/reference/api/go/aspire.hosting.kafka/kafkaserverresource/withdatavolume.md) -- `method` -- Adds a named volume for the data folder to a Kafka container resource.
  ```go
  WithDataVolume(options ...*WithDataVolumeOptions) KafkaServerResource
  ```
- [WithKafkaUI](/reference/api/go/aspire.hosting.kafka/kafkaserverresource/withkafkaui.md) -- `method` -- Adds a Kafka UI container to the application.
  ```go
  WithKafkaUI(options ...*WithKafkaUIOptions) KafkaServerResource
  ```
