KafkaBuilderExtensions Methods
Class Methods 5 members
Provides extension methods for adding Kafka resources to the application model.
AddKafka(IDistributedApplicationBuilder, string, int?) Section titled AddKafka(IDistributedApplicationBuilder, string, int?) extension IResourceBuilder<KafkaServerResource> Adds a Kafka resource to the application. A container is used for local development.
public static class KafkaBuilderExtensions{ public static IResourceBuilder<KafkaServerResource> AddKafka( this IDistributedApplicationBuilder builder, string name, int? port = null) { // ... }}Parameters
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder. name string The name of the resource. This name will be used as the connection string name when referenced in a dependency port int? optional The host port of Kafka broker. Returns
IResourceBuilder<KafkaServerResource> A reference to the ApplicationModel.IResourceBuilder`1. Remarks
This version of the package defaults to the tag of the container image.
WithDataBindMount(IResourceBuilder<KafkaServerResource>, string, bool) Section titled WithDataBindMount(IResourceBuilder<KafkaServerResource>, string, bool) extension IResourceBuilder<KafkaServerResource> Adds a bind mount for the data folder to a Kafka container resource.
public static class KafkaBuilderExtensions{ public static IResourceBuilder<KafkaServerResource> WithDataBindMount( this IResourceBuilder<KafkaServerResource> builder, string source, bool isReadOnly = false) { // ... }}Parameters
builder IResourceBuilder<KafkaServerResource> The resource builder. source string The source directory on the host to mount into the container. isReadOnly bool optional A flag that indicates if this is a read-only mount. Returns
IResourceBuilder<KafkaServerResource> The ApplicationModel.IResourceBuilder`1. WithDataVolume(IResourceBuilder<KafkaServerResource>, string?, bool) Section titled WithDataVolume(IResourceBuilder<KafkaServerResource>, string?, bool) extension IResourceBuilder<KafkaServerResource> Adds a named volume for the data folder to a Kafka container resource.
public static class KafkaBuilderExtensions{ public static IResourceBuilder<KafkaServerResource> WithDataVolume( this IResourceBuilder<KafkaServerResource> builder, string? name = null, bool isReadOnly = false) { // ... }}Parameters
builder IResourceBuilder<KafkaServerResource> The resource builder. name string? optional The name of the volume. Defaults to an auto-generated name based on the application and resource names. isReadOnly bool optional A flag that indicates if this is a read-only volume. Returns
IResourceBuilder<KafkaServerResource> The ApplicationModel.IResourceBuilder`1. WithHostPort(IResourceBuilder<KafkaUIContainerResource>, int?) Section titled WithHostPort(IResourceBuilder<KafkaUIContainerResource>, int?) extension IResourceBuilder<KafkaUIContainerResource> Configures the host port that the KafkaUI resource is exposed on instead of using randomly assigned port.
public static class KafkaBuilderExtensions{ public static IResourceBuilder<KafkaUIContainerResource> WithHostPort( this IResourceBuilder<KafkaUIContainerResource> builder, int? port) { // ... }}Parameters
builder IResourceBuilder<KafkaUIContainerResource> The resource builder for KafkaUI. port int? The port to bind on the host. If null is used random port will be assigned. Returns
IResourceBuilder<KafkaUIContainerResource> The resource builder for KafkaUI. WithKafkaUI(IResourceBuilder<KafkaServerResource>, Action<IResourceBuilder<KafkaUIContainerResource>>, string?) Section titled WithKafkaUI(IResourceBuilder<KafkaServerResource>, Action<IResourceBuilder<KafkaUIContainerResource>>, string?) extension IResourceBuilder<KafkaServerResource> Adds a Kafka UI container to the application.
public static class KafkaBuilderExtensions{ public static IResourceBuilder<KafkaServerResource> WithKafkaUI( this IResourceBuilder<KafkaServerResource> builder, Action<IResourceBuilder<KafkaUIContainerResource>>? configureContainer = null, string? containerName = null) { // ... }}Parameters
builder IResourceBuilder<KafkaServerResource> The Kafka server resource builder. configureContainer Action<IResourceBuilder<KafkaUIContainerResource>> optional Configuration callback for KafkaUI container resource. containerName string? optional The name of the container (Optional). Returns
IResourceBuilder<KafkaServerResource> A reference to the ApplicationModel.IResourceBuilder`1. Remarks
This version of the package defaults to the tag of the container image.