Skip to content

System Architecture

mq9 is composed of two parts: a multi-language SDK that agents and engineers use directly, and a Broker that handles all registry, messaging, and routing logic.

mq9 system architecture


SDK Layer

The SDK is the only surface agents and services interact with. It wraps the NATS-based protocol into typed, language-idiomatic APIs — agents never send raw NATS requests directly.

Six official SDKs are provided:

LanguagePackageInstall
Pythonmq9pip install mq9
JavaScript / TypeScriptmq9npm install mq9
Gogithub.com/robustmq/mq9/gogo get github.com/robustmq/mq9/go
Rustmq9cargo add mq9
Javaio.mq9:mq9Maven / Gradle
C#mq9dotnet add package mq9

All six SDKs expose an identical API surface. Adding a new protocol operation means updating all six simultaneously — there is no per-language divergence.

Transport: Every SDK communicates with the broker using the NATS protocol over $mq9.AI.* subjects. Any environment that can open a TCP connection to port 4222 can connect.


Broker

The broker is a single binary with no external runtime dependencies. It handles three concerns:

Protocol and routing

Receives all SDK requests over NATS, routes them to the correct internal handler: registry operations (AGENT.REGISTER, AGENT.DISCOVER, etc.) or messaging operations (MSG.SEND, MSG.FETCH, MSG.ACK, etc.).

Agent Registry

Maintains the AgentCard index. Supports both full-text keyword search and semantic vector search over capability descriptions. TTL-based auto-expiry removes stale registrations.

Reliable Async Messaging

Manages persistent mailboxes. Stores messages server-side, applies priority ordering (critical > urgent > normal), tracks consumer group offsets, and enforces message-level and mailbox-level TTLs.


Cluster Mode

A single broker node handles millions of concurrent agent connections. When throughput or availability requirements grow, the broker scales horizontally.

mq9 cluster topology

Key properties of the cluster:

  • All nodes are active — there is no primary/standby split. Agents can connect to any node.
  • Consistent routing — the Meta Service (Raft-based) handles cluster membership, placement decisions, and leader election.
  • Transparent scale-out — add a new broker node and it joins the cluster live. No downtime, no reconnection required from the SDK side.
  • Unchanged API — the SDK connection string points to the cluster (or a load balancer in front). The API is identical whether there is one node or twenty.

When to scale

ScenarioApproach
Development / testingSingle node (docker run robustmq/robustmq)
Production, moderate loadSingle node with persistent volume
High throughput / HA requirement3+ node cluster behind a load balancer
Data sovereignty / multi-regionSeparate deployments per region; federation (roadmap)

Storage

The broker's storage layer is pluggable:

BackendUse case
MemoryDevelopment, testing — no persistence
RocksDBProduction — durable, low-latency local storage
S3 TieringCold archive for high-volume deployments (roadmap)

Storage is decoupled from compute. In cluster mode, storage can scale independently of the broker nodes.


Deployment

Single node (development)

bash
docker run -d --name mq9 -p 4222:4222 -v mq9-data:/data robustmq/robustmq:latest

Single node (production)

bash
docker run -d \
  --name mq9 \
  -p 4222:4222 \
  -p 9090:9090 \
  -v /data/mq9:/data \
  --restart unless-stopped \
  robustmq/robustmq:latest
  • Port 4222 — mq9/NATS protocol (SDK connections)
  • Port 9090 — Prometheus metrics

Cluster deployment

Refer to the RobustMQ cluster deployment guide for multi-node configuration. The SDK server parameter accepts a comma-separated list of node addresses or a load balancer URL — no code change is required when moving from single-node to cluster.