Capstone Project
An order-processing system with routing, retries, failover, and replay
Build an order-processing system on this module's cluster, using every
chapter. Put the code in rabbitmq/capstone/ and commit as you go.
Milestone 1: topology as code
- Extend
config/definitions.json: anorderstopic exchange (already there), queues forbilling,shipping.eu,shipping.us,email, andfraud, each bound to the keys it needs, all quorum queues. - One user per service with anchored, least-privilege permissions.
- An alternate exchange on
ordersthat collects unroutable messages intoorders.unrouted.
Done when: rabbitmqctl list_queues name type members shows every
queue with 3 members after a cluster rebuild from scratch.
Milestone 2: reliable publishing
- An order API that publishes with async publisher confirms and
mandatory, keeping a bounded in-flight window, and retries nacked or returned messages. - Handles
connection.blockedby failing requests fast with a clear error instead of hanging.
Done when: a load test at 2,000 orders/s shows no unconfirmed messages, and a memory alarm makes the API return errors within a second.
Milestone 3: consumers that fail well
- Each consumer acks after processing, with prefetch tuned to its job.
- Idempotent processing (dedup on order id).
- Retry with exponential backoff through 5 s, 30 s, and 5 min wait queues, then a parking queue, with the attempt count in a header.
- A replay script that moves parked messages back after a fix.
Done when: a downstream outage of 3 minutes recovers on its own with no lost orders and no duplicates in the database.
Milestone 4: audit stream
- Every order event also goes to an
orders.auditstream (exchange-to-exchange binding or a fanout), kept 30 days. - A reconciliation job reads yesterday's audit stream by timestamp offset and compares it with the billing database.
Milestone 5: operations
- Grafana: RabbitMQ Overview plus a service dashboard (orders/s, per-queue depth and age, retries, parked messages).
- Alerts with runbooks: backlog growth per queue, parked messages, resource alarms, unroutable messages.
- A rolling restart of all three nodes under load using
drainandrevive, with no failed publishes. - The game day from Failure Scenarios.
Stretch goals
- Federate
ordersto a second cluster (a copy of this compose file on other ports) as a disaster-recovery site. - Bridge to the Kafka module: a Shovel or a small
service that copies
orders.auditinto a Kafka topic for analytics. - Use the stream protocol (rstream) for the audit consumer and compare throughput with AMQP.
Write rabbitmq/capstone/TOPOLOGY.md: every exchange, queue, binding,
and policy, who publishes and who consumes, the retry and dead-letter
path, and what happens when the queue is full. In RabbitMQ the topology
is the architecture, and it's the first thing a new team member needs.