Skip to content
DocsTry Aspire
DocsTry

MosquittoBuilderExtensions Methods

ClassMethods3 members
Provides extension methods for adding Mosquitto resources to an Hosting.IDistributedApplicationBuilder.
AddMosquitto(IDistributedApplicationBuilder, string, int?)Section titled AddMosquitto(IDistributedApplicationBuilder, string, int?)extensionIResourceBuilder<MosquittoServerResource>
Adds a Mosquitto container resource to the application. Mosquitto is an open source MQTT message broker, so the resource can be referenced by any MQTT client integration.
public static class MosquittoBuilderExtensions
{
public static IResourceBuilder<MosquittoServerResource> AddMosquitto(
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 MQTT endpoint is exposed on. If null a random port is assigned.
IResourceBuilder<MosquittoServerResource>A reference to the ApplicationModel.IResourceBuilder`1.
This version of the package defaults to the tag of the container image.
WithDataBindMount(IResourceBuilder<MosquittoServerResource>, string, bool)Section titled WithDataBindMount(IResourceBuilder<MosquittoServerResource>, string, bool)extensionIResourceBuilder<MosquittoServerResource>
Adds a bind mount for the data folder to a Mosquitto container resource.
public static class MosquittoBuilderExtensions
{
public static IResourceBuilder<MosquittoServerResource> WithDataBindMount(
this IResourceBuilder<MosquittoServerResource> builder,
string source,
bool isReadOnly = false)
{
// ...
}
}
builderIResourceBuilder<MosquittoServerResource>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<MosquittoServerResource>A reference to the ApplicationModel.IResourceBuilder`1.
WithDataVolume(IResourceBuilder<MosquittoServerResource>, string?, bool)Section titled WithDataVolume(IResourceBuilder<MosquittoServerResource>, string?, bool)extensionIResourceBuilder<MosquittoServerResource>
Adds a named volume for the data folder to a Mosquitto container resource.
public static class MosquittoBuilderExtensions
{
public static IResourceBuilder<MosquittoServerResource> WithDataVolume(
this IResourceBuilder<MosquittoServerResource> builder,
string? name = null,
bool isReadOnly = false)
{
// ...
}
}
builderIResourceBuilder<MosquittoServerResource>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<MosquittoServerResource>A reference to the ApplicationModel.IResourceBuilder`1.