CommunityToolkit.Aspire.Hosting.Mosquitto 17.0.0

Prefix Reserved
dotnet add package CommunityToolkit.Aspire.Hosting.Mosquitto --version 17.0.0
                    
NuGet\Install-Package CommunityToolkit.Aspire.Hosting.Mosquitto -Version 17.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Mosquitto" Version="17.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.Mosquitto" Version="17.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Mosquitto" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CommunityToolkit.Aspire.Hosting.Mosquitto --version 17.0.0
                    
#r "nuget: CommunityToolkit.Aspire.Hosting.Mosquitto, 17.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CommunityToolkit.Aspire.Hosting.Mosquitto@17.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CommunityToolkit.Aspire.Hosting.Mosquitto&version=17.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CommunityToolkit.Aspire.Hosting.Mosquitto&version=17.0.0
                    
Install as a Cake Tool

CommunityToolkit.Aspire.Hosting.Mosquitto

Overview

This Aspire hosting integration runs Eclipse Mosquitto in a container. Mosquitto is an open source MQTT message broker, so the resource can be referenced by any MQTT client integration. The integration exposes the MQTT endpoint on port 1883 (target port tcp) and a protocol-level health check so the broker only reports healthy once it actually accepts MQTT connections.

Usage

Example 1: Add a Mosquitto broker

var builder = DistributedApplication.CreateBuilder(args);

var mqtt = builder.AddMosquitto("mqtt");

builder.AddProject<Projects.MyApp>("myapp")
       .WithReference(mqtt)
       .WaitFor(mqtt);

builder.Build().Run();

The connection string injected into the referencing resource is the broker address in the form mqtt://host:port.

Example 2: Pin the MQTT host port

var mqtt = builder.AddMosquitto("mqtt", port: 1883);

Example 3: Persist data with a volume or bind mount

var mqtt = builder.AddMosquitto("mqtt")
                  .WithDataVolume();

// or

var mqtt = builder.AddMosquitto("mqtt")
                  .WithDataBindMount("./mosquitto-data");

Example 4: Mount a custom configuration

By default the integration ships a mosquitto.conf that exposes the MQTT listener on all interfaces (listener 1883), allows anonymous connections, and persists state to /mosquitto/data. To customize the broker, override the configuration with your own mosquitto.conf at /mosquitto/config:

var mqtt = builder.AddMosquitto("mqtt")
                  .WithContainerFiles("/mosquitto/config",
                      [new ContainerFile { Name = "mosquitto.conf", Contents = "listener 1883" }]);

Endpoints

Name Description
tcp MQTT protocol endpoint (port 1883)

Upstream Image

This integration pins the eclipse-mosquitto image (from docker.io) to a specific version tag (2.1.2-alpine) rather than a floating tag. Mosquitto publishes immutable, fully-versioned tags; update the pinned tag to adopt newer releases.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
17.0.0 60 11/20/2026
17.0.0-beta.1090 54 11/20/2026
17.0.0-beta.1088 53 11/20/2026
17.0.0-beta.1080 86 11/20/2026
17.0.0-beta.1078 54 11/19/2026
17.0.0-beta.1077 43 11/19/2026
17.0.0-beta.1076 45 11/19/2026
17.0.0-beta.1075 41 11/19/2026
17.0.0-beta.1052 59 11/16/2026
17.0.0-beta.1051 56 11/12/2026
17.0.0-beta.1033 68 11/10/2026
17.0.0-beta.1022 61 11/8/2026
17.0.0-beta.1018 60 11/6/2026
17.0.0-beta.1009 59 11/5/2026
17.0.0-beta.994 61 11/4/2026
17.0.0-beta.993 64 11/4/2026
13.6.2-beta.959 73 10/27/2026
13.6.1 195 10/26/2026
13.6.1-beta.950 71 10/26/2026
13.6.1-beta.938 64 10/24/2026
Loading failed