Mosquitto icon

Mosquitto

Lightweight MQTT broker for application data exchange on edge devices

Messaging EPL-2.0 / EDL-1.0
Mosquitto illustration

What is this?

Mosquitto is an MQTT message broker — a lightweight post office for your edge device. Applications and sensors publish messages to “topics” and other applications subscribe to receive them. It uses very little memory and CPU, making it ideal for constrained edge hardware.

It handles the data exchange between applications running on your device. For example, a sensor collector publishes temperature readings, and a dashboard application subscribes to display them — Mosquitto routes the messages between them.

Note: Mosquitto serves as the application data plane only. It is not the Margo transport layer. Margo uses pull-based HTTPS REST with RFC 9421 signatures for device management communication.

Example: how a factory uses it

A vibration sensor on a CNC mill publishes readings every 100 milliseconds to the topic mill/spindle/vibration. Three applications subscribe: a local alarm that flashes a warning light if vibration exceeds threshold, a logging app that writes to VictoriaLogs, and a Grafana dashboard showing the live waveform. Mosquitto delivers each message to all three subscribers instantly, using less than 2 MB of RAM.

Network Topology

graph LR
    subgraph Edge Gateway
        NR[Node-RED
:1880] MOSQ[Mosquitto
:1883
~2 MB RAM] HMI[Local HMI] LOG[VictoriaLogs
:9428] end subgraph Field Devices S1[Vibration Sensor] S2[Temp Sensor] end S1 -->|pub mill/vibration| MOSQ S2 -->|pub mill/temp| MOSQ MOSQ -->|sub mill/#| NR MOSQ -->|sub mill/#| HMI MOSQ -->|sub mill/#| LOG NR -->|pub actuators/alarm| MOSQ

Reminder: Mosquitto is the application data plane only — inter-service messaging between containers on the edge gateway. It is NOT the Margo transport layer.

Import this app

Paste this into your Margo manager to import the app:

public.ecr.aws/g2n4p2m7/belden-margo:1.0.3_mosquitto-margo-manifest

Run: oras pull public.ecr.aws/g2n4p2m7/belden-margo:1.0.3_mosquitto-margo-manifest

Technical details

Deployment Profiles

  • PROPOSED — quadlet (WG-PROPOSAL-02)

    Systemd-native deployment using Podman Quadlet. Supports amd64 and arm64.

Application Description (margo.yaml)

apiVersion: margo.org/v1alpha1
kind: ApplicationDescription
id: com-belden-mosquitto
metadata:
  name: "Eclipse Mosquitto"
  version: 1.0.2+mosquitto-margo-manifest
  description: Lightweight MQTT broker for IoT messaging
  catalog:
    application:
      tagline: "Lightweight open-source MQTT broker"
      tags:
        - "iot"
        - "mqtt"
        - "broker"
        - "edge-computing"
    organization:
      - name: "Eclipse Foundation"
        site: "https://mosquitto.org"

deploymentProfiles:
  - id: "quadlet-v1"
    type: "quadlet"
    description: "Systemd-native deployment using Podman Quadlet. Supports amd64 and arm64."
    requiredResources:
      cpu:
        cores: 0.05
        architectures:
          - amd64
          - arm64
      memory: "64Mi"
      storage: "128Mi"
      interfaces:
        - type: ethernet
    components:
      - name: "mosquitto-quadlet"
        properties:
          repository: oci://public.ecr.aws/g2n4p2m7/belden-margo
          revision: 1.0.2_mosquitto-quadlet
          wait: true
          timeout: "2m0s"

parameters:
  mqttPort:
    value: 1883
    targets:
      - pointer: "MQTT_PORT"
        components:
          - mosquitto-quadlet

configuration:
  sections:
    - name: "MQTT"
      settings:
        - parameter: mqttPort
          name: "MQTT Port"
          immutable: false
          schema: mqttPortSchema

  schema:
    - name: mqttPortSchema
      dataType: integer
      minValue: 1
      maxValue: 65535
      allowEmpty: false

Podman Quadlet Units

PROPOSED — quadlet (WG-PROPOSAL-02)

mosquitto.container

[Unit]
Description=Mosquitto MQTT broker
After=network-online.target

[Container]
Image=docker.io/eclipse-mosquitto:2.1.2-alpine
PublishPort=1883:1883

Volume=${QUADLET_DIR}/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro

HealthCmd=mosquitto_sub -i mosquitto-healthcheck -t mosquitto-healthcheck -E
HealthInterval=30s
HealthTimeout=5s
HealthRetries=3
HealthStartPeriod=10s

[Service]
Environment=QUADLET_DIR=%E/containers/systemd
Restart=always

[Install]
WantedBy=default.target

Container Images

Image Reference
docker.io/eclipse-mosquitto:2.1.2-alpine

License

EPL-2.0 / EDL-1.0