NEW RasterizedDB 1.1.0 is out: sharding and the gateway, the message broker, roles and row-level security, compression, .NET on NuGet, and the enterprise edition. What's new ›
MESSAGE BROKER NEW IN 1.1.0

Queues and streams, inside the database.

A message broker built into the server, like the key/value cache. It speaks Kafka, AMQP 0-9-1 (RabbitMQ) and MQTT 3.1.1 and 5.0, plus a faster native protocol, over one engine with its own on-disk format.

Built into every 1.1.0 server. Not built yet: publishing inside a SQL transaction, and reading a topic with SELECT.

HOW IT WORKS · ANIMATED 12 s cycle

One publish, routed to every topic that wants it

New in 1.1.0: a message broker inside the database. Producers on the native protocol, Kafka, AMQP or MQTT publish to an exchange; bindings route each message to topics; subscriptions read them as a stream, a work queue or plain pub/sub.

NATIVE · rdbmq/1fastest path KAFKA PRODUCERclassic protocol AMQP 0-9-1RabbitMQ clients MQTT 3.1.1 / 5.0devices EXCHANGE · orders · topic key: orders.eu.paid orders.eu.* → paid-eu ✓ orders.# → audit ✓ orders.us.* → paid-us direct fanout topic headers TOPIC paid-eu · 3 PARTITIONS sync · fdatasync shared by all TOPIC audit · 1 PARTITION async · flushed every 10 ms TOPIC paid-usno binding matched: untouched ORDERED · consumer grouppartitions shared out, one owner each SHARED · work queueack / nack, redelivery, dead letters BROADCAST · pub/subevery reader sees every message nack → redelivered to another5 deliveries → dlq.paid-eu
  1. 1
    Producers, any protocol

    A native client, a Kafka producer, a RabbitMQ client and an MQTT device all publish to the same broker, inside the same server as the database.

  2. 2
    An exchange routes

    A topic exchange matches the routing key orders.eu.paid against its bindings: orders.eu.* and orders.#.

  3. 3
    Appended, once per topic

    One copy goes to each matched topic, deduplicated, as a batch in the on-disk format the native protocol sends unchanged.

  4. 4
    Made durable

    Per topic: sync acks after an fdatasync shared by every batch since the last one; async after the page cache; memory never touches disk.

  5. 5
    Three ways to read

    ordered: a consumer group, partitions shared out. shared: a work queue with acks and dead-lettering. broadcast: every reader sees everything.

  6. 6
    Acked, or retried

    A nack or a timeout redelivers to another consumer; after max deliveries the message moves to a dead-letter topic.

1 / 4

One engine, four doors

  • Native rdbmq/1: the on-disk format is the wire format, so a batch is checked, stamped and appended as sent
  • Kafka (classic protocol): producers, consumer groups, idempotent producers, SASL
  • AMQP 0-9-1: exchanges, queues, publisher confirms, dead-letter exchanges, TTL
  • MQTT 3.1.1 and 5.0: QoS 0/1/2, retained messages, persistent sessions, shared subscriptions
  • BROKER statements on the SQL ports reach the same engine
shell
rasterizeddb_core --broker-port 9800 --kafka-port 9092 --amqp-port 5672 --mqtt-port 1883
2 / 4

Every pattern from three primitives

A topic is a set of append-only partitions. A subscription reads one topic in one of three modes, and an exchange routes a publish to topics. Every messaging pattern people ask for is a combination of those.

  • ordered: a consumer group; partitions shared out, order kept within each
  • shared: competing consumers with per-message acks, redelivery and dead-lettering
  • broadcast: plain pub/sub, every reader sees everything
  • Exchanges: direct, fanout, topic (with * and # wildcards) and headers
3 / 4

Durability chosen per topic

Logins use the database's own roles, and topics and exchanges need an administrator to create. TLS uses the PostgreSQL port's certificate.

  • sync: acknowledged after an fdatasync that one flush shares across every connection
  • async: acknowledged from the page cache, flushed every few milliseconds
  • memory: a bounded in-memory ring that never touches disk
4 / 4

Replicated, permissioned, crash-tested

  • Replication: topics, batches at their offsets and subscription state ride the same replication stream as the database; a partition is written on one node at a time
  • Permissions per topic and per exchange on every protocol, shown by BROKER SHOW GRANTS
  • Crash tests kill the server mid-produce and check every durable acknowledgement; power loss is modelled with the same harness the database uses
  • rdb_studio's BROKER page: topics, subscriptions and their permissions
✓ page rendered in 365 µs axum + tera + htmx · no other javascript