KafkaBuilderExtensions Methods
ClassMethods5 members
Provides extension methods for adding Kafka resources to the application model.
AddKafka(IDistributedApplicationBuilder, string, int?) Section titled AddKafka(IDistributedApplicationBuilder, string, int?)extensionIResourceBuilder<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
builderIDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder .namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependencyportint?optionalThe 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)extensionIResourceBuilder<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
builderIResourceBuilder<KafkaServerResource> The resource builder.sourcestringThe source directory on the host to mount into the container.isReadOnly booloptionalA 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)extensionIResourceBuilder<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
builderIResourceBuilder<KafkaServerResource> The resource builder.namestring?optionalThe name of the volume. Defaults to an auto-generated name based on the application and resource names.isReadOnly booloptionalA 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?)extensionIResourceBuilder<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
builderIResourceBuilder<KafkaUIContainerResource> The resource builder for KafkaUI.portint?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?)extensionIResourceBuilder<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
builderIResourceBuilder<KafkaServerResource> The Kafka server resource builder.configureContainer Action<IResourceBuilder<KafkaUIContainerResource>> optionalConfiguration callback for KafkaUI container resource.containerName string?optionalThe 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.