---
id: "mqtt-broker"
type: "component"
kind: "pubsub-topic"
provider: "default"
category: "messaging"
docs: "https://mqtt.org/mqtt-specification/"
url: "https://localhost:3000/catalogue/components/mqtt-broker"
---

# MQTT broker

Topic-based publish/subscribe broker for devices (Mosquitto, EMQX, HiveMQ, cloud IoT cores).

| | |
|---|---|
| Provider | [default](https://localhost:3000/catalogue?provider=default) |
| Kind | [Pub/Sub topic](https://localhost:3000/catalogue/kinds/pubsub-topic) |
| Category | Messaging |
| Official docs | [https://mqtt.org/mqtt-specification/](https://mqtt.org/mqtt-specification/) |

## Properties

| property | type | values | required | kind default | this component |
|---|---|---|---|---|---|
| `delivery` | enum | `at-most-once`, `at-least-once`, `exactly-once` | yes | — | **"at-most-once"** |
| `managed` | boolean | — | no | false | inherited |
| `ordering` | enum | `none`, `per-key` | no | "none" | **"per-key"** |
| `persistentSessions` | boolean | — | no | false | inherited |
| `qos` | integer | — | no | 0 | inherited |
| `replay` | boolean | — | no | false | **false** |
| `topicPerEventType` (advanced) | boolean | — | no | true | inherited |

Bold values are the ones this component pins.

## Rules that apply · 1

### Pub/Sub topic where replay is required `pubsub-replay-required` (error)

- Page: https://localhost:3000/catalogue/rules/pubsub-replay-required.md
- Why: The design declares that consumers must be able to replay history. A fan-out topic that does not retain messages cannot deliver that.
- Applies to: every node of kind pubsub-topic
- Message: Topic '{{node.id}}' cannot replay messages, but the design requires replay. Use a stream or a replayable queue.

It fires when:

- all of these hold:
  - the design requirement `messaging.replay` is true
  - the node's `replay` is false

## Other products of the same kind · 12

- [EventBridge](https://localhost:3000/catalogue/components/alibaba-eventbridge.md) `alibaba-eventbridge` — alibabacloud
- [Amazon EventBridge](https://localhost:3000/catalogue/components/aws-eventbridge.md) `aws-eventbridge` — aws
- [Amazon SNS](https://localhost:3000/catalogue/components/sns.md) `sns` — aws
- [Azure Event Grid](https://localhost:3000/catalogue/components/azure-event-grid.md) `azure-event-grid` — azure
- [Azure Event Grid MQTT Broker](https://localhost:3000/catalogue/components/azure-event-grid-mqtt.md) `azure-event-grid-mqtt` — azure
- [Eclipse Mosquitto](https://localhost:3000/catalogue/components/mosquitto.md) `mosquitto` — default
- [NanoMQ](https://localhost:3000/catalogue/components/nanomq.md) `nanomq` — default
- [Generic Pub/Sub topic](https://localhost:3000/catalogue/components/pubsub-topic.md) `pubsub-topic` — default
- [Redis Pub/Sub](https://localhost:3000/catalogue/components/redis-pubsub.md) `redis-pubsub` — default
- [Eventarc](https://localhost:3000/catalogue/components/google-eventarc.md) `google-eventarc` — gcp
- [Google Cloud Pub/Sub](https://localhost:3000/catalogue/components/google-pubsub.md) `google-pubsub` — gcp
- [OCI Events](https://localhost:3000/catalogue/components/oci-events.md) `oci-events` — oci

## Use it in a design

```yaml
nodes:
  - { id: "mqtt-broker", component: "mqtt-broker" }
```

## Source (`component` YAML, verbatim)

```yaml
# yaml-language-server: $schema=../../schema/component.schema.json
# MQTT broker (Mosquitto, EMQX, HiveMQ, IoT Core): topic fan-out for devices. QoS 0 is the wire default,
# so delivery is at-most-once until the client asks for QoS 1 or 2.
schemaVersion: "1"
type: "component"
id: "mqtt-broker"
kind: "pubsub-topic"
provider: "default"
docs: "https://mqtt.org/mqtt-specification/"
defaults:
  delivery: "at-most-once"
  ordering: "per-key"
  replay: false
properties:
  qos:
    type: "integer"
    default: 0
  persistentSessions:
    type: "boolean"
    default: false
```

Human page: https://localhost:3000/catalogue/components/mqtt-broker
