Coming from another broker? 1 / 6

QueenMQ 2.8

Coming from another
message broker?

QueenMQ, a kernel for distributed systems. Most examples start from Kafka; RabbitMQ and SQS join where they differ.

The plan

Eight things you build around a broker, eight chapters.

One hotel booking, booking-9137, goes through every chapter. Click a row to jump there.

  • Each chapter starts with what you build today, mostly on Kafka, with RabbitMQ and SQS where they differ. Then the same thing inside QueenMQ, with code you can run.
  • At the end, three products we run on QueenMQ in production.
Why

Brokers move messages very well. What happens to one message, and around it, is yours to build.

Architecture · three nodes each

Kafka with KRaft and ISR. QueenMQ with one raft log.

Kafka · KRaft + ISRcombined mode: broker and controller on each node
  • Each partition: a leader, and followers that fetch from it. The caught-up ones are the ISR.
  • Metadata: a second raft log, among the controllers. Offsets: the topic __consumer_offsets.
  • Transactions: a coordinator, and markers in every partition.

QueenMQ · one binary, one raft logevery node holds a full copy
  • One leader orders all the tenant's writes. Followers prepare their clients' requests and answer from their copy.
  • One log: messages, acks, KV, timers. Positions and leases: in the leader's memory, checkpointed.
  • A transaction is one log entry: no coordinator, no markers.

Kafka spreads partition leaders over the nodes, so writes use all three. QueenMQ has one leader per tenant: more tenants (raft groups) spread the leaders.

Chapter 1 of 8

One booking =
one partition

In Kafka a partition is a shard you size up front. In QueenMQ it is the thing you work on: one booking, one customer, one conversation.

  1. 1.1Kafka today: bookings share partitions
  2. 1.2QueenMQ: configure, then a partition per booking
  3. 1.3A retry is not a second booking

queue  bookings

Each booking is a partition: an ordered list of its events.

1.1 · Today, on Kafka

A fixed number of partitions. Bookings share them.

  • You pick the partition count when you create the topic.
  • The key is hashed: hash(key) % 4. Here booking-9137 and booking-4410 land in partition 2.
  • One consumer works a partition, in order. A slow message holds up every booking behind it.
  • Add partitions later, and keys move to other partitions.
Elsewhere
RabbitMQ
Competing consumers on one queue lose the order per key. Keeping it takes a queue per key, or a consistent-hash exchange with one consumer per queue.
SQS FIFO
Message groups keep the order per group: the closest thing to a QueenMQ partition.

1.2 · QueenMQ

Configure once. Then every booking is a partition.

// once, before the first push: name every option
await queen.queue('bookings').config({
  leaseTime: 30, retryLimit: 5, retryDelay: 5000,
  dedupWindowSeconds: 86400,
  retentionEnabled: true,
  retentionSeconds: 604800,
}).create()

// then: one partition per booking
await queen.queue('bookings')
  .partition('booking-9137')
  .push([{ data: { event: 'created' } }])
  • Configure first, every option named: a queue a push creates gets a 60 s lease and no retention.
  • Then the first push to a booking creates its partition: no count to pick. Order holds inside it; workers take any partition with work.

1.3 · QueenMQ

A retry is not a second booking.

await queen.queue('bookings')
  .partition('booking-9137')
  .push([{
    transactionId: 'booking-9137-created',
    data: { event: 'created' }
  }])
  • The same transactionId in the same partition, within dedupWindowSeconds (3600 s by default, 7 days at most), writes nothing.
  • Build the id from the work, never from a fresh UUID.
  • Kafka's idempotent producer covers its own retries in one session. An app that retries after a crash writes the event again.
Trap

HTTP answers 201 even when an item is refused. Read each item's status: queued, duplicate or error.

Chapter 2 of 8

Work it,
fail it, retry it

Kafka gives a group one offset per partition. QueenMQ gives every message a lease, an answer, retries and a dead-letter queue, in the broker.

  1. 2.1Kafka today: you commit a position
  2. 2.2A lease, an answer, a retry
  3. 2.3Batches, partitions, concurrency
  4. 2.4Replay: new groups and seek

queue  bookings  · group  confirm

worker-aholds 9137 #3 · lease 30 s
worker-bholds booking-2203 #6
Dead-letter queue · confirm booking-4410 #2 · card service timeout · 5 failures

Every message: a lease, an answer, and a place to go when it keeps failing.

2.1 · Today, on Kafka

One offset per partition. A failure blocks it, or breaks order.

// KafkaJS: you commit a position, not an answer
const c = kafka.consumer({ groupId: 'confirm' })
await c.subscribe({ topics: ['bookings'] })
await c.run({
  autoCommit: false,
  eachMessage: async (m) => {
    await confirm(m.message) // throw: blocks
    const n = BigInt(m.message.offset) + 1n
    await c.commitOffsets([{ topic: m.topic,
      partition: m.partition, offset: `${n}` }])
  },
})
Elsewhere
RabbitMQ
An ack per message, and dead letters after a delivery limit (quorum queues). The order across consumers is not kept.
SQS
A visibility timeout per message, a lease, and a redrive to a DLQ after maxReceiveCount. In a FIFO queue a failing message holds its group, as in QueenMQ.

2.2 · QueenMQ

Every message gets a lease and an answer.

await queen.queue('bookings')
  .group('confirm')
  .each()
  .consume(async (msg) => {
    await confirm(msg.data)  // throw = failed
  })  // return = completed
  • A pop leases the message to one worker for leaseTime (30 s). A worker that dies: the lease runs out, another worker gets it, and no retry is spent.
  • A throw is a failed answer: the message comes back after retryDelay (5 s), and only its booking waits.
  • After retryLimit failures (5), it goes to the dead-letter queue with its error, and the booking moves on.
  • Every group gets every message and its workers compete, as in Kafka. Two more answers: retry (no retry spent) and dlq (now).

2.3 · QueenMQ

Fewer round trips, the same order.

await queen.queue('bookings')
  .group('confirm')
  .batch(100)        // messages per pop
  .partitions(10)    // bookings per pop
  .concurrency(4)    // handlers at once
  .renewLease(true, 10000)
  .each()
  .consume(confirm)
  • .partitions(N): one pop drains up to N bookings, each one still in order.
  • Leave batch and partitions out, and the broker sizes every pop (autopilot).
  • .renewLease(true, 10000) keeps the lease while a long handler runs.
  • .partition('booking-9137') pops one booking only.

2.4 · QueenMQ

The history stays. A seek moves a group.

// a new group can start in the past
await queen.queue('bookings')
  .group('audit')
  .subscriptionFrom('2026-11-10T10:00:00Z')
  .consume(audit)

// a group that exists moves with a seek
await queen.admin.seekConsumerGroup(
  'confirm', 'bookings',
  { timestamp: '2026-11-10T10:00:00Z' })
// { toEnd: true }: skip all it has not read
  • An answer moves the group's cursor. The message stays until retention removes it.
Trap

A new group starts at the end (new), like auto.offset.reset=latest. .subscriptionMode('all') reads the history; .subscriptionFrom(time) starts at a time.

Chapter 3 of 8

One step =
one commit

Confirming a booking is several writes: its state, the next event, the ack. In QueenMQ they are one log entry, all of them or none.

  1. 3.1Kafka today: three systems, no commit
  2. 3.2One transaction
  3. 3.3State next to the messages: KV
One log entry
ackbookings · booking-9137 #3 · group confirm
kvbookings/booking-9137 = confirmed
pushemails · booking-9137 · confirm-mail
timerpayment-reminders · booking-9137 · 15 min

One call commits all four, or none of them.

3.1 · Today, on Kafka

Three systems, and no commit across them.

  • Confirming a booking: update Postgres, produce to emails, commit the offset.
  • A crash between two of them leaves the step half done.
  • Kafka transactions cover Kafka's writes and offsets, not your database.
  • The usual fix: an outbox table, a relay to read it, an idempotency table. More systems.
Elsewhere
RabbitMQ
Publisher confirms, and channel transactions that cover its own publishes and acks. Never your database.
SQS
Send and delete are separate calls: nothing commits them together.

3.2 · QueenMQ

The ack, the state, the next event: one commit.

.consume(async (msg) => {
  const id = msg.partition   // booking-9137
  await queen.transaction()
    .ack(msg, 'completed',
      { consumerGroup: 'confirm' })
    .kv.put('bookings', id,
      { status: 'confirmed' }, { ttl: '30d' })
    .queue('emails').partition(id)
    .push([{ transactionId: `mail-${id}`,
      data: { id } }])
    .commit()
})
  • One call, one log entry: all of it commits, or none.
  • A call to the outside (a payment, an email provider) is not in the commit: give it an idempotency key from the message.

3.3 · QueenMQ

The state lives next to the messages.

const id = 'booking-9137'
const b = await queen.kv.get('bookings', id)
// { found, value, version: 3 }

const r = await queen.kv.put('bookings', id,
  { status: 'checked-in' },
  { ttl: '30d', expect: b.version })
r.applied  // false if someone wrote since

await queen.kv.incr('quota', 'hotel-7', 1,
  { max: 500, ttl: '1d' })
  • Every write names its lifetime: a ttl, or forever.
  • Every write raises the version. expect makes a write depend on it.
  • A write that did not apply answers applied: false and the current value. It is not an error.
  • KV has no queries: records you search stay in your database.

Chapter 4 of 8

Waiting
without cron

"Remind the guest in 15 minutes if they have not paid" is a message that arrives later. In QueenMQ it is a timer, written by the step that wants it.

  1. 4.1Kafka today: a scheduler on the side
  2. 4.2Timers
  3. 4.3Timers inside the transaction
  4. 4.4A delay for a whole queue

timer  payment-reminders / booking-9137

booking-9137
10:00 createdno payment yet
timer
scheduled for 10:15
reminders
a message
10:0010:0710:15

The timer fires as a message, in the booking's own partition.

4.1 · Today, on Kafka

Kafka delivers now. "Later" is another system.

  • Kafka has no delay per message.
  • Teams add a table of due reminders and a cron job that scans it every minute.
  • Or one delay topic per duration, with consumers that wait until each message is due.
  • Moving or cancelling a reminder means finding it again.
Elsewhere
RabbitMQ
A message TTL plus a dead-letter exchange, or the delayed-message plugin, which keeps delayed messages on one node.
SQS
DelaySeconds, up to 15 minutes per message.

4.2 · QueenMQ

A timer is a message for later.

// booking-9137 is created
await queen.timer('payment-reminders')
  .key('booking-9137')
  .partition('booking-9137')
  .delay('15m')
  .payload({ id: 'booking-9137' })
  .schedule()          // 'scheduled'

// the guest paid
await queen.timer('payment-reminders')
  .key('booking-9137').cancel()
  • Named by its queue and key. The same key scheduled again moves it.
  • It fires as a real message, through the log: never early, a little late (checked every 50 ms).
  • With the booking's partition, it arrives in order with the booking's events.

4.3 · QueenMQ

Schedule it in the step that wants it.

// the booking step
await queen.transaction()
  .ack(msg, 'completed',
    { consumerGroup: 'bookings' })
  .timer('payment-reminders').key(id)
  .partition(id).delay('15m')
  .payload({ id }).schedule()
  .commit()

// the payment step
await queen.transaction()
  .ack(pay, 'completed',
    { consumerGroup: 'payments' })
  .kv.put('bookings', id, { status: 'paid' },
    { ttl: '30d' })
  .timer('payment-reminders').key(id).cancel()
  .commit()
Trap

absent on a cancel may mean the timer already fired: the reminder's handler checks the booking first.

4.4 · QueenMQ

The same wait for every message: two queue options.

await queen.queue('room-updates')
  .config({
    leaseTime: 30,
    retryLimit: 5,
    retryDelay: 5000,
    dedupWindowSeconds: 86400,
    retentionEnabled: true,
    retentionSeconds: 604800,
    delayedProcessing: 300, // 5 min each
    windowBuffer: 3,        // bursts
  })
  .create()
  • delayedProcessing: every new message waits that many seconds after its push.
  • windowBuffer: a burst waits that long, then is handed over as one batch. A delay per message is a timer.

Chapter 5 of 8

Only one
worker

Some work no message starts: the nightly report, the channel sync. A cron job on three replicas runs it three times. A lock runs it once, and a guard keeps out a holder that froze.

  1. 5.1Kafka today: a lock on the side
  2. 5.2A lock and a guard

lock  nightly-report

holderworker-b
since · until02:00:00 · 02:00:30, renewed
token42
worker-aacquire → false
worker-bholds it
worker-cacquire → false

Three replicas, one holder.

5.1 · Today, on Kafka

A lock that expires does not stop its holder.

  • Kafka has no lock. Teams take one in Redis, ZooKeeper or the database.
  • A lock with a TTL can expire during a GC pause or a network stall, and nobody tells the holder.
  • Another worker takes it. The old holder wakes up and writes anyway.
  • The fix is a fencing token that the storage checks. Your code, again.
Elsewhere
RabbitMQ
Single active consumer gives a queue one reader. Work that no message starts still needs a lock.
SQS
No lock: a conditional write in another store, often DynamoDB.

5.2 · QueenMQ

The guard keeps out a holder that froze.

const lock = queen.lock('nightly-report',
  { ttl: '30s' })
if (!(await lock.acquire({ wait: '5s' })))
  return             // another worker has it
try {
  const r = await queen.transaction()
    .guard(lock)    // only while it is ours
    .queue('reports')
    .push([{ transactionId: 'report-11-11',
      data: report }])
    .commit()
} finally {
  await lock.release()
}
  • The handle renews the lock every third of its lifetime. A frozen process cannot, and .guard(lock) rolls its commit back.
  • queen.semaphore(name, n): n holders. Outside QueenMQ, fence with lock.token.

Chapter 6 of 8

The booking page:
now, not history

A page wants the latest availability and a price within half a second. It does not need the history of either.

  1. 6.1Kafka today: every value, and a reply topic
  2. 6.2Only the newest value: conflation
  3. 6.3Ask and answer: ephemeral queues
  4. 6.4The trade

Hotel 7 · Deluxe room · tonight

rooms left9the newest value · conflation
price€129asked now · an ephemeral reply

Two numbers that must be fresh, and nothing to keep.

6.1 · Today, on Kafka

Every value is delivered. A reply needs its own topic.

  • A compacted topic keeps the last value per key, later, on closed segments. A live consumer still reads every value.
  • A request and its reply over Kafka: a request topic, a reply topic, a correlation id, and a consumer that waits. All of it on disk.
  • Or a direct HTTP call, which ties the page to the pricing service.
Elsewhere
RabbitMQ
Direct reply-to is built in, close to QueenMQ's ephemeral queues. The latest value per key needs a plugin.
SQS
No request/reply: a reply queue per caller, or AWS's temporary-queue client.

6.2 · QueenMQ

Only the newest value: conflation.

await queen.queue('availability')
  .group('screen')
  .conflation(true)  // the newest, per partition
  .partitions(64)
  .consume(async (msg) => {
    await redraw(msg.data)
  })
  • A pop of a partition delivers one message, the newest, and moves the cursor past the ones it skipped.
  • It belongs to the group. Another group on the same queue still gets every message.
  • Nothing is deleted: it is not compaction. Retention decides what stays.
Promise

After the last push to a partition, at least one handler run starts after it.

6.3 · QueenMQ

Ask, and wait half a second at most.

async function quote(room) {
  const inbox = `inbox-${crypto.randomUUID()}`
  await queen.ephemeral.push('quotes',
    [{ room, replyTo: inbox }])
  const reply = await queen.ephemeral.pop(inbox,
    { wait: true, timeout: 500,
      commitOnDelivery: true })
  return reply.messages[0]?.payload
    ?? { room, price: null }   // "ask us"
}
  • Ephemeral queues live in memory, outside the log, created on first use. Same groups, leases and acks.
  • Every node serves every queue: a partition has one owner node, and the others forward to it.
  • The caller makes a private inbox, sends it as replyTo, and waits with a timeout.

6.4 · QueenMQ

Fast, because it forgets.

queueephemeral
kept inthe raft log, on diskmemory of one node
a node crashesnothing lostits share is lost
a node stopsnothing lostit hands its partitions over
transactions, DLQ, replayyesno
groups, leases, acksyesyes
Why

An answer that comes too late is worth nothing, so it does not need a disk. Anything that must survive a crash goes on a regular queue.

Chapter 7 of 8

The whole history,
live

Every push of every queue, in the order the log committed it: one feed, to ask what happened and to compute as it happens.

  1. 7.1Kafka today: ask three topics
  2. 7.2The feed
  3. 7.3A join between queues
  4. 7.4Patterns, joins, windows
  5. 7.5Live state and shards

queen.feed()

positionqueuepartitiondata
1041bookingsbooking-9137created
1042bookingsbooking-4410created
1043paymentsbooking-9137paid · €387
1043emailsbooking-9137confirm-mail
1044availabilityhotel-79 rooms

One position across every queue. The pushes of one transaction share it.

7.1 · Today, on Kafka

What happened to booking-9137? Ask three topics.

  • Each topic is its own log with its own offsets. There is no order across topics.
  • Finding one booking means reading every partition of every topic, or exporting to a search index first.
  • Stream processing is Kafka Streams: Java only, state in RocksDB and changelog topics, repartition topics to join by key.
Elsewhere
RabbitMQ, SQS
A message is gone once it is acked: no history to ask (RabbitMQ Streams aside).
Pulsar
History is kept; stream processing is Pulsar Functions or Flink.

7.2 · QueenMQ

One log of everything, in commit order.

// what happened to one booking, in the last day
for await (const e of queen.feed({
  partitions: ['booking-9137'],
  since: '1d', follow: false,
})) {
  console.log(e.position, e.queue, e.data)
}

// live: every Italian booking from now on
queen.feed({ queues: ['bookings'],
  where: [['data.country', '=', 'IT']] })
  • One position across all queues. Nothing is leased or acked: every group still gets its messages.
  • Followers serve it, not the leader. where is checked by the broker.

7.3 · QueenMQ

Join two queues by booking.

await Stream
  .fromFeed(queen,
    { queues: ['bookings', 'payments'] })
  .join({
    sides: { booking: 'bookings',
             paid: 'payments' },
    within: '1h',
    select: (got, id) => ({ id,
      amount: got.paid.data.amount }),
    onTimeout: (got, missing, id) =>
      ({ id, missing }),
  })
  .to(queen.queue('paid-bookings'))
  .run({ queryId: 'paid-bookings' })
  • The key is the partition: booking-9137 in bookings meets booking-9137 in payments, in either order.
  • The position commits with the outputs. After a restart the open joins come back from a snapshot, and nothing is sent twice.

7.4 · QueenMQ

A booking, then its payment within 15 minutes.

Stream.fromFeed(queen,
    { queues: ['bookings', 'payments'] })
  .pattern({
    key: (m) => m.partition,
    start: (m) => m.queue === 'bookings',
    then: (m) => m.queue === 'payments',
    within: '15m',
    onMatch: (b) => ({ paid: b.partition }),
    onTimeout: (b) => ({ remind: b.partition }),
  })
  .to(queen.queue('payment-followups'))
  .run({ queryId: 'payment-followups' })
  • Chapter 4's reminder, as a stream: a booking, then its payment, or a reminder. .joinTable adds the latest row of a table queue to each message.
  • Windows run on the log's clock: a quiet feed still closes them on time.

7.5 · QueenMQ

Read a stream's state live, from any process.

await Stream
  .fromFeed(queen, { queues: ['availability'] })
  .windowTumbling({ seconds: 60 })
  .aggregate({ count: () => 1 })
  .name('perMinute')
  .run({ queryId: 'per-minute', shards: 4 })

// anywhere else
const { found, value } = await Stream
  .view(queen, 'per-minute')
  .get('perMinute', 'hotel-7')
  • shards: 4: four processes, each with its partitions, its position and its lock.
  • Event time: a step can order messages by a time inside them (eventTime, allowedLateness).

Chapter 8 of 8

Postgres in,
Postgres out

The broker streams a table into a queue, and a queue into a table. No Debezium, no Connect cluster, no consumer to write.

  1. 8.1Kafka today: three systems to move a row
  2. 8.2The source
  3. 8.3The sink
  4. 8.4Four things to know

one HTTP call each, on the broker

PostgreSQLpublic.bookings
↓ source · logical replication
queue bookingsa partition per row key
↓ sink · a group the broker runs
PostgreSQLpublic.bookings_report

Both run on every node of the cluster, with exactly-once effects.

8.1 · Today, on Kafka

Debezium, Connect, Kafka: three systems to move a row.

  • Change data capture is Debezium, running on a Kafka Connect cluster, writing to Kafka.
  • Back into a table: a JDBC sink connector, or a consumer you write.
  • Each one has its own configuration, its own offsets and its own ways to fail.
Elsewhere

Debezium Server, a process of its own, writes changes to RabbitMQ, Kinesis, Pub/Sub and others.

8.2 · QueenMQ

A table becomes a queue, in commit order.

PUT /api/v1/connectors/bookings-src
{
  "kind": "source",
  "connection": {
    "host": "pg", "database": "app",
    "user": "queen", "password": "…" },
  "source": { "tables": [
    { "table": "public.bookings",
      "queue": "bookings" } ] }
}
  • Each committed change is a message, in the partition named after the row's key. One Postgres transaction is one QueenMQ transaction.
  • The WAL position commits with the messages: after a crash, nothing is sent twice.
  • Needs PostgreSQL 17+, wal_level=logical, and QUEEN_ENCRYPTION_KEY on the broker.

8.3 · QueenMQ

A queue becomes a table, exactly once.

PUT /api/v1/connectors/bookings-report
{
  "kind": "sink",
  "connection": { … },
  "sink": { "queue": "bookings",
            "table": "public.bookings_report",
            "mode": "upsert" }
}
appendeach message is a new row
upsertinsert, or update the row with its key, with the columns it names
cdca source event, applied: insert, update, delete
sqlyour statement, with parameters from the message

8.4 · QueenMQ

Four things to know before you turn it on.

The slot keeps WAL

A replication slot keeps WAL while the source is down, and can fill the database's disk. Set max_slot_wal_keep_size, and alert on queen_pg_source_slot_lag_bytes.

Every table needs a key

A primary key, or a unique index as replica identity. A table without one is refused.

A refused row

A message Postgres refuses (a constraint, a wrong type) is tried a few times, then dead-lettered with the database's error. Its partition goes on.

Key = partition

In upsert and cdc mode, keep the table's key aligned with the partition. Order holds inside a partition: two partitions writing one row would race.

In production

Three systems
we run on QueenMQ

Not a booking we made up: a guest chat, a channel manager and a tracing service, as they run today. Names are simplified; the flows are real.

  1. 9.1A guest chat: a partition per conversation
  2. 9.2A channel manager: one door in, one door out, a gate
  3. 9.3A tracing service: QueenMQ and object storage
systemit shows
guest chatpartitions · one commit per step · groups · windowBuffer · ephemeral request/reply
channel managerpartitions by state · conflation · timers · KV as a rate limit
tracing servicea stream with session windows · groups · reads by offset

Each flow as it runs; the names are not the real ones.

In production · a guest chat

One conversation, one partition, one commit per step.

Usespartition = chat · ack + push in one transaction · a group per client · DLQ · windowBuffer · ephemeral request/reply · KV, lock, timer

LessonCarry one id through every step. A hop that drops it can only be followed by guesswork.

In production · a channel manager and Gate

One door in, one door out, and a gate to the travel sites.

Usespartition by state · ack + push + KV in one transaction · conflation · timers · ephemeral request/reply · Gate: kv.incr as the rate limit

LessonA message is a key, not a payload. A partition whose messages carried every past version kept growing.

In production · a tracing service

Tracing on QueenMQ and object storage, nothing else.

Usespartition = trace id · dedup by event key · a session-window stream · an archiver group · reads by offset · KV

LessonKeep big bodies out of window state: very large traces held whole in a window pushed the brokers past their memory. Since 2.7.0 QueenMQ reads state without copying it.

The end

Eight systems became one broker.

  • Retries and dead letters: a lease and an answer per message.
  • Outbox and idempotency table: one commit.
  • Reminders table and cron: timers.
  • Redis locks: a lock, and a guard on the commit.
  • Reply queues: ephemeral queues.
  • A stream processor and a search index: the feed.
  • Debezium and Connect: connectors in the broker.
Why

Each box was a system to run, and a seam where a step could come apart.

The end

Move one service at a time.

docker run -p 6632:6632 -p 127.0.0.1:9092:9092 \
  -v /var/lib/queen:/var/lib/queen/raft \
  -e QUEEN_KAFKA_EMBEDDED=true \
  -e QUEEN_KAFKA_ADVERTISED_ADDR=127.0.0.1:9092 \
  ghcr.io/queen-mq/queen:2.10.0
  • Kafka producers, consumers and admin tools work as they are: change bootstrap.servers, nothing else.
  • A topic is a queue, a Kafka consumer group is a QueenMQ group. Kafka clients and QueenMQ clients read and write the same data.
  • From RabbitMQ or SQS there is no port: move one service at a time with the SDKs.

The end

Build on QueenMQ, unless it is a firehose.

  • One leader orders all of a queue's writes, and more nodes do not raise that. Transactions too: about 12,900 a second per tenant on 16 vCPU.
  • Three 24-vCPU nodes, one queue of 1,000 partitions: QueenMQ carried 3,000,000 msg/s at a p99 of 15 ms, and not 5,500,000. Kafka carried about 8,000,000 at 12 ms, answering before any fsync.
  • Kafka's lead ends as partitions multiply: at 10,000 it used twice QueenMQ's CPU, and it did not carry 50,000.
Why

One leader per tenant is what makes a transaction one log entry. That is the trade: a ceiling, for steps that cannot come apart.

you are buildinguse
services that handle events per customer, order or bookingQueenMQ: a partition each
steps that must commit whole: the ack, the state, the next event, the timerQueenMQ: one transaction
routing by contentQueenMQ: a router step reads, picks the queue, pushes and acks in one commit
only the latest value per keyQueenMQ: conflation, or KV
a step that needs SQL to decideQueenMQ: query your database, commit the step with KV conditions
long workflowsQueenMQ: a transaction per step, KV state, timers for the waits
a firehose: millions of messages a second, where every millisecond countsKafka or Pulsar

The end

Try it in
five minutes

docker run -p 6632:6632 ghcr.io/queen-mq/queen:2.10.0
npm install queen-mq

The dashboard is at localhost:6632, served by the same process.

← → to move · F full screen