MQTT Fundamentals

MQTT vs AMQP: Differences, Use Cases and Performance

MQTT and AMQP are both brokered messaging protocols, but they solve different problems. This comparison covers routing, delivery guarantees, footprint and typical architectures so you can pick with confidence.

Diagram contrasting a topic-based MQTT broker with an AMQP exchange routing to queues, illustrating MQTT vs AMQP
Run this on your own MQTT brokerGet a private, managed MQTT broker on the Free plan and start from ready-made code samples.
Try it free Code samples No card required

MQTT vs AMQP comes up whenever a team building connected devices also runs backend services on a message broker such as RabbitMQ. Both protocols are brokered, both run over TCP and both offer delivery acknowledgments, yet they were designed for very different jobs. This guide compares broker models, routing, guarantees and client footprint, and ends with a practical rule for when each one belongs in your architecture.

Where Each Protocol Comes From

MQTT was designed for telemetry from remote equipment over unreliable, low-bandwidth links. Its priorities are a tiny client, a small packet format and a simple model: clients publish to hierarchical topics and subscribe with wildcards. It is an OASIS standard, with versions 3.1.1 and 5.0 in wide use.

AMQP (Advanced Message Queuing Protocol) came out of the financial industry, where the priority was reliable, interoperable messaging between business systems. It has two quite different lineages. AMQP 0-9-1 is the model most developers know from RabbitMQ, with exchanges, bindings and queues. AMQP 1.0 is the OASIS and ISO standard, a more general peer-to-peer transfer protocol used by services such as Azure Service Bus and supported by brokers like Apache ActiveMQ Artemis. When someone says "AMQP", it is worth asking which one they mean.

MQTT vs AMQP at a Glance

Aspect MQTT AMQP 0-9-1 (RabbitMQ style) AMQP 1.0
Core model Topics with publish/subscribe Exchanges route to queues via bindings Links between nodes; broker semantics defined by implementation
Routing Hierarchical topics, + and # wildcards Direct, topic, fanout, headers exchanges Addresses and filters, broker-specific
Queues No explicit queues (session queues per client) Explicit, named, durable queues Broker-defined nodes
Delivery guarantees QoS 0, 1, 2 Acks, publisher confirms, transactions Settlement modes, at-most-once and at-least-once
Work distribution Shared subscriptions (MQTT 5) Competing consumers on a queue Competing receivers on a node
Flow control Receive maximum (MQTT 5) Prefetch (basic.qos) Credit-based link flow control
Header size Very small, 2-byte minimum fixed header Larger frames and properties Larger, richly typed encoding
Client footprint Fits on microcontrollers Comfortable on servers and gateways Comfortable on servers and gateways
Typical home Devices, gateways, browsers, mobile apps Backend microservices, task queues Enterprise integration, cloud messaging services

Broker Model and Routing

An MQTT broker routes purely by topic. A publisher sends to plant1/line2/press4/temperature, and every client whose subscription filter matches receives a copy. There is no separate routing configuration; the topic hierarchy is the routing table. This makes MQTT easy to adopt and easy to reason about, especially when topics follow a structure like ISA-95 or a Unified Namespace. The MQTT publish/subscribe model article explains the decoupling in more depth.

AMQP 0-9-1 separates where messages are sent (an exchange) from where they are stored (queues). Bindings connect the two with rules. A topic exchange behaves a bit like MQTT wildcards, a fanout exchange copies to every bound queue, and a direct exchange routes by an exact key. This flexibility is powerful for backend workflows such as fanning an order event out to billing, shipping and analytics queues, each with its own retention and consumers. The price is more concepts to learn and more configuration to manage.

Delivery Guarantees

MQTT offers three QoS levels: at most once (QoS 0), at least once (QoS 1) and exactly once between client and broker (QoS 2). Persistent sessions let the broker hold QoS 1 and 2 messages for a subscriber that is temporarily offline. For a refresher, see MQTT QoS levels explained.

AMQP gives you consumer acknowledgments, negative acknowledgments with requeue, publisher confirms and, in 0-9-1, transactions. Messages sit in a durable queue until a consumer explicitly acks them, which is exactly what you want for jobs such as "generate this invoice" that must be processed by exactly one worker and retried if it fails.

In practice both can deliver reliably. The difference is emphasis: MQTT is optimized for streams of state and events to many subscribers, AMQP for durable work items handled by competing consumers.

Performance and Footprint

Neither protocol is "faster" in the abstract. Throughput depends far more on the broker implementation, persistence settings, message size and acknowledgment mode than on the wire format.

Where the protocols clearly differ is footprint. An MQTT client library fits comfortably on an ESP32 or similar microcontroller, and the packet overhead per message is tiny, which matters on cellular and satellite links. AMQP clients are heavier, frames carry more metadata, and connection setup involves more negotiation. On a server that difference is irrelevant; on a battery-powered sensor it is decisive.

MQTT also handles very large numbers of mostly idle connections well, which is the normal shape of an IoT fleet. AMQP brokers are usually tuned for fewer, busier connections from services.

Typical Architectures

The most common real-world answer to MQTT vs AMQP is "both, at different layers":

  1. Devices, gateways and dashboards connect to an MQTT broker.
  2. A backend service subscribes to the relevant MQTT topics, for example plant1/+/+/telemetry.
  3. That service validates and enriches the data, then publishes work items to an AMQP queue for downstream processing such as billing, ticketing or ERP updates.

Here is a minimal bridge in Python that subscribes on MQTT and publishes into a RabbitMQ queue with pika. It runs as its own process, so you control batching, filtering and error handling.

import json
import uuid

import paho.mqtt.client as mqtt
import pika

PREFIX = "connectmq/demo/replace-me"

amqp = pika.BlockingConnection(pika.ConnectionParameters("localhost"))
channel = amqp.channel()
channel.queue_declare(queue="telemetry", durable=True)

def on_connect(client, userdata, flags, reason_code, properties):
    print("MQTT connected:", reason_code)
    client.subscribe(f"{PREFIX}/+/telemetry", qos=1)

def on_message(client, userdata, msg):
    try:
        body = json.loads(msg.payload)
    except json.JSONDecodeError:
        print("skipping invalid payload on", msg.topic)
        return
    body["topic"] = msg.topic
    channel.basic_publish(
        exchange="",
        routing_key="telemetry",
        body=json.dumps(body),
        properties=pika.BasicProperties(delivery_mode=2),  # persistent
    )

client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2,
                     client_id=f"amqp-bridge-{uuid.uuid4().hex[:8]}")
client.on_connect = on_connect
client.on_message = on_message
client.connect("broker.connectmq.com", 1883, keepalive=30)
client.loop_forever()

For production, connect to your private broker over TLS on 8883 with client.tls_set() and client.username_pw_set("YOUR_USERNAME", "YOUR_PASSWORD"), and use the client ID issued with those credentials. Because pika's blocking connection is not thread-safe, keep all AMQP calls inside the MQTT network loop thread as shown, or hand messages to a queue consumed by a dedicated AMQP thread.

When to Choose MQTT

  • Clients are microcontrollers, gateways, mobile apps or browsers.
  • Connections are unreliable, metered or high-latency.
  • Many consumers need the same stream of telemetry or state.
  • You need online/offline detection (keep alive and Last Will) and last-known values (retained messages).
  • You want a simple model that field engineers and integrators can understand from the topic names alone.

When to Choose AMQP

  • Messages are units of work that one consumer must process and acknowledge.
  • You need sophisticated routing rules, dead-letter queues and per-queue policies.
  • All producers and consumers are backend services in a data center or cloud.
  • You are integrating enterprise systems that already speak AMQP 1.0.

Why a Managed MQTT Broker Is Often the Simpler Fit

For the device-facing side, operational simplicity usually wins. A fully managed MQTT service removes the work of patching, certificate renewal, scaling connection counts and multi-tenant isolation, and leaves your team to focus on the topic design and the consumers. ConnectMQ supports MQTT 3.1.1 and 5.0, TLS with a Let's Encrypt certificate, shared subscriptions on the paid Serverless plan and per-plan quotas with flood protection. It does not include an AMQP bridge, so you keep the bridge as your own service, exactly as shown above. To compare hosting options more broadly, read the cloud MQTT broker guide, and for a refresher on topics and sessions see the MQTT tutorial. If you are weighing queues versus brokers conceptually, MQTT broker vs message queue goes deeper.

Get Started with ConnectMQ

Put your devices on ConnectMQ over MQTT and keep AMQP for the backend workflows it is best at. Create a free Serverless broker at app.connectmq.com, no credit card required, grab the generated credentials and point your devices and your bridge service at it in minutes.

Frequently Asked Questions

Is MQTT better than AMQP for IoT?

For devices, usually yes: MQTT clients are smaller, packets are lighter and the model handles many intermittent connections well. AMQP is better suited to backend work queues.

Can RabbitMQ speak MQTT?

RabbitMQ offers an MQTT plugin that maps MQTT topics onto its exchange model. A dedicated MQTT broker typically gives you fuller MQTT feature support and simpler operations for large device fleets.

Does MQTT have queues like AMQP?

Not explicitly. The broker keeps a per-client session queue for persistent sessions, and MQTT 5 shared subscriptions let several consumers split a topic's messages, which covers many queue-like use cases.

Can I use MQTT and AMQP together?

Yes, and it is common. Devices publish over MQTT, and a bridge service subscribes and forwards selected messages into AMQP queues for backend processing.

Related articles

Why Your MQTT Client Keeps Disconnecting (and How to Fix It)

Reconnect loops are one of the most common MQTT problems. Learn the five usual causes, from duplicate client IDs to keep alive timeouts and oversized packets, and follow a diagnosis flow that pinpoints yours.

8 min read

Who Invented MQTT? The History from Oil Pipelines to IoT

MQTT was invented in 1999 by Andy Stanford-Clark of IBM and Arlen Nipper of Arcom to monitor oil pipelines over satellite. Follow its path to open source, OASIS, ISO and today's managed cloud brokers.

7 min read

MQTT Maximum Message Size: Limits and Large Payload Strategies

MQTT can technically carry a 256 MB packet, but brokers, client libraries and devices impose far lower limits. Learn where the real limits are, what happens when you exceed them, and how to send large payloads.

7 min read

All articles →

Your private MQTT broker is a few clicks away

Create an account, get your broker credentials and connect your first device — no servers to install, patch or scale.