Skip to content

New Integration Component: CommunityToolkit.Aspire.Hosting.Mosquitto #1519

Description

@IgorShaposhnikov

Related to an existing integration?

No

Existing integration

CommunityToolkit.Aspire

Overview

Problem Description

Developers building .NET Aspire applications need a seamless, out-of-the-box way to host and orchestrate an Eclipse Mosquitto MQTT broker during local development. Currently, setting up Mosquitto in .NET Aspire requires manual container resource configuration, custom health checks, and manual connection string injection, which introduces boilerplate code across projects.

Proposed Solution

Introduce CommunityToolkit.Aspire.Hosting.Mosquitto to the community toolkit to easily run Eclipse Mosquitto in a container. The integration should:

  • Expose the standard MQTT endpoint on port 1883 (protocol tcp).
  • Include a protocol-level health check ensuring the resource only reports healthy once it actively accepts MQTT connections.
  • Automatically inject a connection string formatted as mqtt://host:port into referencing resources.
  • Provide simple extension methods for pinning host ports (port: 1883), persisting data (WithDataVolume() / WithDataBindMount()), and overriding the default mosquitto.conf via container files.

Usage example

var builder = DistributedApplication.CreateBuilder(args);

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

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

builder.Build().Run();

Breaking change?

No

Alternatives

Alternatives Considered

Manually configuring generic containers using builder.AddContainer("mosquitto", "eclipse-mosquitto"), which requires developers to write their own health checks and connection string mapping logic manually.

Additional Context

The upstream image should target the immutable, fully-versioned eclipse-mosquitto image from docker.io (e.g., pinned to tag 2.0.22 instead of floating tags) to ensure build reliability.

Help us help you

Yes, I'd like to be assigned to work on this item

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions