# Overview

MQ Gateway connects MQTT 3.1.1, MQTT 5.0 and AMQP 1.0 clients to [NATS](https://nats.io). Devices, PLCs and AMQP applications keep their protocol and their client libraries. Behind the gateway, every message is a NATS message, so these clients exchange messages with NATS services and with each other.

The gateway is not a broker. NATS routes the messages, applies the permissions and stores what must be kept. The gateway keeps nothing of its own, so you can run as many gateways as you need.

[TrialGet the licensed build and a license from Synadia.](/mq-gateway/0.4/trial.md)[PlaygroundRun the playground and pass messages between MQTT, AMQP and NATS clients.](/mq-gateway/0.4/tutorials/playground.md)[How it worksThe ideas behind the gateway, on one page.](/mq-gateway/0.4/explanation/how-it-works.md)[InstallInstall the binary or run the container image.](/mq-gateway/0.4/how-to/install.md)

## Why use it

* **Bring existing clients to NATS.** MQTT devices and AMQP or JMS applications connect without a code change.
* **One system to run.** Storage, security and clustering come from the NATS system you already operate, not from a second broker.
* **One set of subjects.** An MQTT topic, an AMQP address and a NATS subject name the same messages.
* **Storage only where you ask for it.** QoS 0 and presettled AMQP messages travel over core NATS. QoS 1 and 2 and unsettled AMQP messages go to the streams that you bind.

## Concepts

| Term      | What it is                                                                                                                                             |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Subject   | The NATS name of a message, such as `plant1.line1.temp`. The MQTT topic `plant1/line1/temp` and the AMQP address `plant1.line1.temp` are this subject. |
| Stream    | A JetStream stream. It stores messages, as a durable queue does in a broker.                                                                           |
| Binding   | A config entry that stores a set of subjects in a stream. MQTT QoS 1 and 2 and unsettled AMQP need one.                                                |
| Bucket    | A JetStream KV bucket. MQTT retained messages, MQTT sessions and AMQP delivery counts each live in a bucket that you name.                             |
| Listener  | A port that the gateway serves MQTT or AMQP on. Its auth mode decides which NATS user a client acts as.                                                |
| NATS user | The identity that a client acts as. NATS applies that user's permissions to everything the client does.                                                |

You create the streams and buckets. The gateway never creates, changes or deletes them.
