Skip to content
Docs Try Aspire

RabbitMQBuilderExtensions Methods

Class Methods 5 members
Provides extension methods for adding RabbitMQ resources to an Hosting.IDistributedApplicationBuilder.
AddRabbitMQ(IDistributedApplicationBuilder, string, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, int?) Section titled AddRabbitMQ(IDistributedApplicationBuilder, string, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, int?) extension IResourceBuilder<RabbitMQServerResource>
Adds a RabbitMQ container to the application model.
public static class RabbitMQBuilderExtensions
{
public static IResourceBuilder<RabbitMQServerResource> AddRabbitMQ(
this IDistributedApplicationBuilder builder,
string name,
IResourceBuilder<ParameterResource>? userName = null,
IResourceBuilder<ParameterResource>? password = null,
int? port = null)
{
// ...
}
}
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.
userName IResourceBuilder<ParameterResource> optional The parameter used to provide the user name for the RabbitMQ resource. If null a default value will be used.
password IResourceBuilder<ParameterResource> optional The parameter used to provide the password for the RabbitMQ resource. If null a random password will be generated.
port int? optional The host port that the underlying container is bound to when running locally.
IResourceBuilder<RabbitMQServerResource> A reference to the ApplicationModel.IResourceBuilder`1.
This version of the package defaults to the tag of the container image.
WithDataBindMount(IResourceBuilder<RabbitMQServerResource>, string, bool) Section titled WithDataBindMount(IResourceBuilder<RabbitMQServerResource>, string, bool) extension IResourceBuilder<RabbitMQServerResource>
Adds a bind mount for the data folder to a RabbitMQ container resource.
public static class RabbitMQBuilderExtensions
{
public static IResourceBuilder<RabbitMQServerResource> WithDataBindMount(
this IResourceBuilder<RabbitMQServerResource> builder,
string source,
bool isReadOnly = false)
{
// ...
}
}
builder IResourceBuilder<RabbitMQServerResource> 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.
IResourceBuilder<RabbitMQServerResource> The ApplicationModel.IResourceBuilder`1.
WithDataVolume(IResourceBuilder<RabbitMQServerResource>, string?, bool) Section titled WithDataVolume(IResourceBuilder<RabbitMQServerResource>, string?, bool) extension IResourceBuilder<RabbitMQServerResource>
Adds a named volume for the data folder to a RabbitMQ container resource.
public static class RabbitMQBuilderExtensions
{
public static IResourceBuilder<RabbitMQServerResource> WithDataVolume(
this IResourceBuilder<RabbitMQServerResource> builder,
string? name = null,
bool isReadOnly = false)
{
// ...
}
}
builder IResourceBuilder<RabbitMQServerResource> 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.
IResourceBuilder<RabbitMQServerResource> The ApplicationModel.IResourceBuilder`1.
WithManagementPlugin(IResourceBuilder<RabbitMQServerResource>) Section titled WithManagementPlugin(IResourceBuilder<RabbitMQServerResource>) extension IResourceBuilder<RabbitMQServerResource>
Configures the RabbitMQ container resource to enable the RabbitMQ management plugin.
public static class RabbitMQBuilderExtensions
{
public static IResourceBuilder<RabbitMQServerResource> WithManagementPlugin(
this IResourceBuilder<RabbitMQServerResource> builder)
{
// ...
}
}
builder IResourceBuilder<RabbitMQServerResource> The resource builder.
IResourceBuilder<RabbitMQServerResource> The ApplicationModel.IResourceBuilder`1.
DistributedApplicationException Thrown when the current container image and tag do not match the defaults for RabbitMQServerResource.
This method only supports custom tags matching the default RabbitMQ ones for the corresponding management tag to be inferred automatically, e.g. 4, 4.0-alpine, 4.0.2-management-alpine, etc. Calling this method on a resource configured with an unrecognized image registry, name, or tag will result in a Hosting.DistributedApplicationException being thrown. This version of the package defaults to the tag of the container image.
WithManagementPlugin(IResourceBuilder<RabbitMQServerResource>, int?) Section titled WithManagementPlugin(IResourceBuilder<RabbitMQServerResource>, int?) extension IResourceBuilder<RabbitMQServerResource>
Configures the RabbitMQ container resource to enable the RabbitMQ management plugin.
public static class RabbitMQBuilderExtensions
{
public static IResourceBuilder<RabbitMQServerResource> WithManagementPlugin(
this IResourceBuilder<RabbitMQServerResource> builder,
int? port)
{
// ...
}
}
builder IResourceBuilder<RabbitMQServerResource> The resource builder.
port int? The host port that can be used to access the management UI page when running locally.
IResourceBuilder<RabbitMQServerResource> The ApplicationModel.IResourceBuilder`1.
DistributedApplicationException Thrown when the current container image and tag do not match the defaults for RabbitMQServerResource.
Use RabbitMQBuilderExtensions.WithManagementPlugin to specify a port to access the RabbitMQ management UI page.
var rabbitmq = builder.AddRabbitMQ("rabbitmq")
.WithDataVolume()
.WithManagementPlugin(port: 15672);