Getting started

Build OrbitMQ from source, run it, and publish your first messages over MQTT 3.1.1 and 5.0.

Build from source

No pre-built binaries or container images are published yet. Build the orbitmq binary from the broker repository as shown below.

Requirements

  • A checkout of the OrbitMQ broker repository.
  • The Rust toolchain pinned in its rust-toolchain.toml (Rust 1.99.0). With rustup, the right version is installed automatically the first time you run cargo in the checkout.
  • Linux or macOS. On Linux the broker uses io_uring and falls back to epoll; on macOS it uses kqueue. The startup log line I/O backend: ... says which one it got (and why io_uring is unavailable, if it is). In containers it is epoll by default: see Running in containers.

Build

From the root of the broker repository:

cargo build --release -p orbitmq-server
./target/release/orbitmq --version

The binary is target/release/orbitmq. It has no runtime dependencies besides the operating system; copy it wherever you like.

Run with defaults

./target/release/orbitmq

With no configuration file, the broker:

  • listens for plain MQTT over TCP on 0.0.0.0:1883 (a listener named default);
  • starts one data-plane core per CPU;
  • accepts MQTT 3.1, 3.1.1 and 5.0 clients;
  • allows anonymous clients and applies no ACL, and logs a warning about it because the listener is not on loopback;
  • keeps the admin API and /metrics off, because no admin token is configured.

It logs to stderr:

INFO orbitmq_core::broker: listening listener=default kind=tcp addr=0.0.0.0:1883
INFO orbitmq_core::broker: broker started cores=8
INFO orbitmq_server: I/O backend: io_uring
INFO orbitmq_server: admin API disabled: set [admin] tokens (or insecure = true on loopback)

The I/O backend line reads kqueue on macOS, and on Linux without io_uring it names epoll and the reason, for example I/O backend: epoll (io_uring unavailable: io_uring_setup returned EPERM: blocked by seccomp (container default profile)).

Press Ctrl+C (SIGINT) or send SIGTERM to stop it gracefully.

Defaults are for local use

The default listener accepts anonymous clients on every interface. Before exposing the broker, configure authentication and an ACL, or bind to 127.0.0.1.

To listen somewhere else, set ORBITMQ_LISTEN:

ORBITMQ_LISTEN=127.0.0.1:1884 ./target/release/orbitmq

Other quick overrides are ORBITMQ_CORES (number of cores) and ORBITMQ_LOG (log filter, for example debug). Every override is listed in the configuration reference.

First publish and subscribe

Any MQTT client works. These examples use the Eclipse Mosquitto command-line clients (mosquitto_sub and mosquitto_pub, packaged as mosquitto-clients on Debian and Ubuntu and as mosquitto in Homebrew).

In one terminal, subscribe to everything under demo/ and print each topic:

mosquitto_sub -h localhost -p 1883 -V mqttv311 -t 'demo/#' -v

In another, publish a message, then a retained QoS 1 message:

mosquitto_pub -h localhost -p 1883 -V mqttv311 -t demo/hello -m 'hello orbit'
mosquitto_pub -h localhost -p 1883 -V mqttv311 -t demo/status -m 'online' -q 1 -r

The subscriber prints demo/hello hello orbit and demo/status online. A subscriber that connects later still receives demo/status, because it is retained. Use -V mqttv31 to try MQTT 3.1.

Use a configuration file

The broker reads one TOML file, chosen in this order:

  1. --config <path> (or -c <path>) on the command line;
  2. the ORBITMQ_CONFIG environment variable;
  3. ./orbitmq.toml in the working directory, if it exists;
  4. otherwise built-in defaults.

Environment variables such as ORBITMQ_LISTEN are applied on top of the file. Unknown keys are rejected, so a typo stops the broker with an error instead of being ignored.

A small example with a second, WebSocket listener and the admin API:

orbitmq.toml
listen = "0.0.0.0:1883"

[[listener]]
name = "websocket"
bind = "0.0.0.0:8083"
kind = "ws"

[admin]
listen = "127.0.0.1:18083"
tokens = ["replace-with-a-long-random-token"]
./target/release/orbitmq --config orbitmq.toml
curl -H 'Authorization: Bearer replace-with-a-long-random-token' http://127.0.0.1:18083/api/v1/status

The broker repository ships crates/orbitmq-server/orbitmq.example.toml with every key and its default.

Next

On this page