# KafkaServerResource

- Kind: `class`
- Package: [Aspire.Hosting.Kafka](/reference/api/csharp/aspire.hosting.kafka.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Kafka/KafkaServerResource.cs)
- Inherits: `ContainerResource`
- Implements: `IExpressionValue`, `IManifestExpressionProvider`, `IResource`, `IResourceWithConnectionString`, `IResourceWithEnvironment`, `IValueProvider`, `IValueWithReferences`

A resource that represents a Kafka broker.

## Definition

```csharp
namespace Aspire.Hosting;

public class KafkaServerResource
    : Aspire.Hosting.ApplicationModel.ContainerResource,
      Aspire.Hosting.ApplicationModel.IExpressionValue,
      Aspire.Hosting.ApplicationModel.IManifestExpressionProvider,
      Aspire.Hosting.ApplicationModel.IResource,
      Aspire.Hosting.ApplicationModel.IResourceWithConnectionString,
      Aspire.Hosting.ApplicationModel.IResourceWithEnvironment,
      Aspire.Hosting.ApplicationModel.IValueProvider,
      Aspire.Hosting.ApplicationModel.IValueWithReferences
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting.Kafka/KafkaServerResource`

## Constructors

- [KafkaServerResource(string)](/reference/api/csharp/aspire.hosting.kafka/kafkaserverresource/constructors.md#constructor-string) -- A resource that represents a Kafka broker.

## Properties

- [ConnectionStringExpression](/reference/api/csharp/aspire.hosting.kafka/kafkaserverresource/properties.md#connectionstringexpression) : `ReferenceExpression` `get` -- Gets the connection string expression for the Kafka broker.
- [Host](/reference/api/csharp/aspire.hosting.kafka/kafkaserverresource/properties.md#host) : `EndpointReferenceExpression` `get` -- Gets the host endpoint reference for the primary endpoint.
- [InternalEndpoint](/reference/api/csharp/aspire.hosting.kafka/kafkaserverresource/properties.md#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 [KafkaServerResource.PrimaryEndpoint](/reference/api/csharp/aspire.hosting.kafka/kafkaserverresource/properties.md#primaryendpoint).
- [Port](/reference/api/csharp/aspire.hosting.kafka/kafkaserverresource/properties.md#port) : `EndpointReferenceExpression` `get` -- Gets the port endpoint reference for the primary endpoint.
- [PrimaryEndpoint](/reference/api/csharp/aspire.hosting.kafka/kafkaserverresource/properties.md#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 [KafkaServerResource.InternalEndpoint](/reference/api/csharp/aspire.hosting.kafka/kafkaserverresource/properties.md#internalendpoint).
