Patterns and recipes built on Queen.
Queen on its own is a partitioned message broker. The same
queen-mq
npm package also ships a fluent stream-processing SDK — windows, joins,
stateful reducers, and gates — that runs in your own Node process and
commits state, sink emissions, and source acks atomically in PostgreSQL.
The pages below are end-to-end recipes that combine the broker with the
streaming SDK to solve real production problems.
Each card below links to a dedicated page with code you can copy-paste and numbers from real verified runs against a live Queen server.
Canonical recipes
Rate limiter for external APIs
Throttle outbound calls to OTAs, LLM providers, or any third-party API with a token-bucket gate. Per-key state, FIFO order on retries, no deferred queue, scales linearly with multiple stream consumers.
Subscription replay
Rewind a brand-new consumer group to any timestamp and reprocess just that window — without disturbing the production consumer. Each CG has its own offset row in PostgreSQL, so production and replay run truly independently.
Transactional multi-stage pipelines
Chain multiple processing stages — translate → route → notify — with one PG transaction per handoff. A worker crash between stages cannot duplicate or drop a message. Per-stage retries and DLQ are built in.
Real-time per-entity aggregations
Maintain rolling per-customer count / sum / max / avg over tumbling
windows. State is a row in queen_streams.state
— your Grafana, Metabase, or BI tool queries it as plain SQL. No
Materialize, no ksqlDB, no extra database.
Webhook deduplication
Drop duplicate webhook deliveries from Stripe, Booking, Octorate, or Twilio without operating Redis. The per-window seen-set lives in PostgreSQL and is garbage-collected automatically when the window closes — no TTL job, no eviction policy.
A pattern you'd like to see?
These pages are written from real production code — not idealised examples.
Each card above includes verified numbers from a live run against
localhost:6632. If you have built something on Queen +
streams that fits a generalisable pattern, please open an issue at
github.com/queen-mq/queen
with a short description and we'll add a recipe page for it.
