Skip to content
DocsTry Aspire
DocsTry

RedPandaBuilderExtensions Methods

ClassMethods8 members
Provides extension methods for adding Redpanda resources to an Hosting.IDistributedApplicationBuilder.
AddRedPanda(IDistributedApplicationBuilder, string, int?)Section titled AddRedPanda(IDistributedApplicationBuilder, string, int?)extensionIResourceBuilder<RedPandaServerResource>
Adds a Redpanda container resource to the application. Redpanda is a Kafka API compatible streaming platform, so the resource can be referenced by any Kafka client integration.
public static class RedPandaBuilderExtensions
{
public static IResourceBuilder<RedPandaServerResource> AddRedPanda(
this IDistributedApplicationBuilder builder,
string name,
int? port = null)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder to add the resource to.
namestringThe name of the resource. This name is used as the connection string name when referenced in a dependency.
portint?optionalThe host port that the Kafka API is exposed on. If null a random port is assigned.
IResourceBuilder<RedPandaServerResource>A reference to the ApplicationModel.IResourceBuilder`1.
This version of the package defaults to the tag of the container image.
AddRedPanda(IDistributedApplicationBuilder, string, Action<RedPandaServerOptions>, int?)Section titled AddRedPanda(IDistributedApplicationBuilder, string, Action<RedPandaServerOptions>, int?)extensionIResourceBuilder<RedPandaServerResource>
Adds a Redpanda container resource to the application, using a delegate to configure broker options such as the CPU and memory limits. Redpanda is a Kafka API compatible streaming platform, so the resource can be referenced by any Kafka client integration.
public static class RedPandaBuilderExtensions
{
public static IResourceBuilder<RedPandaServerResource> AddRedPanda(
this IDistributedApplicationBuilder builder,
string name,
Action<RedPandaServerOptions> configureOptions,
int? port = null)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder to add the resource to.
namestringThe name of the resource. This name is used as the connection string name when referenced in a dependency.
configureOptionsAction<RedPandaServerOptions>A delegate that configures the RedPandaServerOptions for the broker.
portint?optionalThe host port that the Kafka API is exposed on. If null a random port is assigned.
IResourceBuilder<RedPandaServerResource>A reference to the ApplicationModel.IResourceBuilder`1.
This version of the package defaults to the tag of the container image.
WithConsole(IResourceBuilder<RedPandaServerResource>, Action<IResourceBuilder<RedPandaConsoleContainerResource>>, string?)Section titled WithConsole(IResourceBuilder<RedPandaServerResource>, Action<IResourceBuilder<RedPandaConsoleContainerResource>>, string?)extensionIResourceBuilder<RedPandaServerResource>
Adds a Redpanda Console container to the application, configured to connect to the Redpanda broker.
public static class RedPandaBuilderExtensions
{
public static IResourceBuilder<RedPandaServerResource> WithConsole(
this IResourceBuilder<RedPandaServerResource> builder,
Action<IResourceBuilder<RedPandaConsoleContainerResource>>? configureContainer = null,
string? containerName = null)
{
// ...
}
}
builderIResourceBuilder<RedPandaServerResource>The Redpanda server resource builder.
configureContainerAction<IResourceBuilder<RedPandaConsoleContainerResource>>optionalAn optional callback to configure the Redpanda Console container resource.
containerNamestring?optionalThe name of the container (optional).
IResourceBuilder<RedPandaServerResource>A reference to the ApplicationModel.IResourceBuilder`1 for the Redpanda server resource.
This version of the package defaults to the tag of the container image.
WithDataBindMount(IResourceBuilder<RedPandaServerResource>, string, bool)Section titled WithDataBindMount(IResourceBuilder<RedPandaServerResource>, string, bool)extensionIResourceBuilder<RedPandaServerResource>
Adds a bind mount for the data folder to a Redpanda container resource.
public static class RedPandaBuilderExtensions
{
public static IResourceBuilder<RedPandaServerResource> WithDataBindMount(
this IResourceBuilder<RedPandaServerResource> builder,
string source,
bool isReadOnly = false)
{
// ...
}
}
builderIResourceBuilder<RedPandaServerResource>The resource builder.
sourcestringThe source directory on the host to mount into the container.
isReadOnlybooloptionalA flag that indicates if this is a read-only mount.
IResourceBuilder<RedPandaServerResource>A reference to the ApplicationModel.IResourceBuilder`1.
WithDataVolume(IResourceBuilder<RedPandaServerResource>, string?, bool)Section titled WithDataVolume(IResourceBuilder<RedPandaServerResource>, string?, bool)extensionIResourceBuilder<RedPandaServerResource>
Adds a named volume for the data folder to a Redpanda container resource.
public static class RedPandaBuilderExtensions
{
public static IResourceBuilder<RedPandaServerResource> WithDataVolume(
this IResourceBuilder<RedPandaServerResource> builder,
string? name = null,
bool isReadOnly = false)
{
// ...
}
}
builderIResourceBuilder<RedPandaServerResource>The resource builder.
namestring?optionalThe name of the volume. Defaults to an auto-generated name based on the application and resource names.
isReadOnlybooloptionalA flag that indicates if this is a read-only volume.
IResourceBuilder<RedPandaServerResource>A reference to the ApplicationModel.IResourceBuilder`1.
WithHostPort(IResourceBuilder<RedPandaConsoleContainerResource>, int?)Section titled WithHostPort(IResourceBuilder<RedPandaConsoleContainerResource>, int?)extensionIResourceBuilder<RedPandaConsoleContainerResource>
Configures the host port that the Redpanda Console resource is exposed on instead of using a randomly assigned port.
public static class RedPandaBuilderExtensions
{
public static IResourceBuilder<RedPandaConsoleContainerResource> WithHostPort(
this IResourceBuilder<RedPandaConsoleContainerResource> builder,
int? port)
{
// ...
}
}
builderIResourceBuilder<RedPandaConsoleContainerResource>The resource builder for the Redpanda Console.
portint?The port to bind on the host. If null a random port is assigned.
IResourceBuilder<RedPandaConsoleContainerResource>A reference to the ApplicationModel.IResourceBuilder`1.
WithHostPort(IResourceBuilder<RedPandaKafkaUiContainerResource>, int?)Section titled WithHostPort(IResourceBuilder<RedPandaKafkaUiContainerResource>, int?)extensionIResourceBuilder<RedPandaKafkaUiContainerResource>
Configures the host port that the Kafka UI resource is exposed on instead of using a randomly assigned port.
public static class RedPandaBuilderExtensions
{
public static IResourceBuilder<RedPandaKafkaUiContainerResource> WithHostPort(
this IResourceBuilder<RedPandaKafkaUiContainerResource> builder,
int? port)
{
// ...
}
}
builderIResourceBuilder<RedPandaKafkaUiContainerResource>The resource builder for the Kafka UI.
portint?The port to bind on the host. If null a random port is assigned.
IResourceBuilder<RedPandaKafkaUiContainerResource>A reference to the ApplicationModel.IResourceBuilder`1.
WithKafkaUI(IResourceBuilder<RedPandaServerResource>, Action<IResourceBuilder<RedPandaKafkaUiContainerResource>>, string?)Section titled WithKafkaUI(IResourceBuilder<RedPandaServerResource>, Action<IResourceBuilder<RedPandaKafkaUiContainerResource>>, string?)extensionIResourceBuilder<RedPandaServerResource>
Adds a Kafka UI container to the application, configured to connect to the Redpanda broker. This is the same Kafka management UI (the kafbat/kafka-ui image) used by the official Aspire Kafka integration, so it works against any Kafka API compatible broker.
public static class RedPandaBuilderExtensions
{
public static IResourceBuilder<RedPandaServerResource> WithKafkaUI(
this IResourceBuilder<RedPandaServerResource> builder,
Action<IResourceBuilder<RedPandaKafkaUiContainerResource>>? configureContainer = null,
string? containerName = null)
{
// ...
}
}
builderIResourceBuilder<RedPandaServerResource>The Redpanda server resource builder.
configureContainerAction<IResourceBuilder<RedPandaKafkaUiContainerResource>>optionalAn optional callback to configure the Kafka UI container resource.
containerNamestring?optionalThe name of the container (optional).
IResourceBuilder<RedPandaServerResource>A reference to the ApplicationModel.IResourceBuilder`1 for the Redpanda server resource.
This version of the package defaults to the tag of the container image.