Examples
Every runnable pattern, in order of complexity
The examples/ directory
contains runnable examples for every feature. Start RabbitMQ first:
docker compose -f examples/docker-compose.yml up -dThen run any example:
npx tsx examples/<folder>/<file>.tsCatalog
| Example | What it shows |
|---|---|
00-basics/direct | Direct exchange routing by exact routing key |
00-basics/fanout | Fanout broadcast to multiple queues |
00-basics/topic-microservices | Small event-driven microservices flow |
01-confirms | Publisher confirms vs normal publish |
01-confirms/dedupe | Consumer-side de-duplication |
02-rpc | Basic typed request/reply flow |
02-rpc-advanced | RPC timeouts, slow responders, concurrency, poison messages |
03-dlq | Dead-letter queue basics |
04-plugins | Cross-cutting plugin hooks for logging, headers, metrics, tracing |
05-backpressure | Publisher and consumer backpressure |
06-retry-dlq | Immediate retry followed by DLQ |
07-escape-hatch | Native amqplib options and raw channel access |
08-health-shutdown | Health checks and graceful shutdown |
09-developer-experience | Headers, tracing metadata, middleware, dedupe, size guard, RPC |
10-delayed-retry | Delayed retry using TTL + DLX |
11-lifecycle-hooks | Broker lifecycle events |
12-opentelemetry | OpenTelemetry lifecycle adapter |
13-topology-planner | Read-only topology planning with topologyMode: "plan-only" |
14-topology-validation | Validating a plan against a live broker |
15-dlq-redrive | CLI redrive from a dead-letter queue |
16-topology-modes | assert / passive / plan-only side by side |
17-idempotent-consumer | Building idempotent handlers for at-least-once delivery |
18-exponential-backoff | Exponential retry backoff with per-attempt TTL parking |
19-exchange-only-producer | Producer declares only the exchange (no queue) via public broker.exchange() |