Skip to content
DocsTry Aspire
DocsTry

RabbitMQBuilderExtensions Methods

ClassMethods5 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?)extensionIResourceBuilder<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)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder.
namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependency.
userNameIResourceBuilder<ParameterResource>optionalThe parameter used to provide the user name for the RabbitMQ resource. If null a default value will be used.
passwordIResourceBuilder<ParameterResource>optionalThe parameter used to provide the password for the RabbitMQ resource. If null a random password will be generated.
portint?optionalThe 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)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<RabbitMQServerResource>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<RabbitMQServerResource>The ApplicationModel.IResourceBuilder`1.
WithDataVolume(IResourceBuilder<RabbitMQServerResource>, string?, bool)Section titled WithDataVolume(IResourceBuilder<RabbitMQServerResource>, string?, bool)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<RabbitMQServerResource>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<RabbitMQServerResource>The ApplicationModel.IResourceBuilder`1.
WithManagementPlugin(IResourceBuilder<RabbitMQServerResource>)Section titled WithManagementPlugin(IResourceBuilder<RabbitMQServerResource>)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<RabbitMQServerResource>The resource builder.
IResourceBuilder<RabbitMQServerResource>The ApplicationModel.IResourceBuilder`1.
DistributedApplicationExceptionThrown 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?)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<RabbitMQServerResource>The resource builder.
portint?The host port that can be used to access the management UI page when running locally.
IResourceBuilder<RabbitMQServerResource>The ApplicationModel.IResourceBuilder`1.
DistributedApplicationExceptionThrown 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);