Learn Labs
Capstone

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: an orders topic exchange (already there), queues for billing, shipping.eu, shipping.us, email, and fraud, each bound to the keys it needs, all quorum queues.
  • One user per service with anchored, least-privilege permissions.
  • An alternate exchange on orders that collects unroutable messages into orders.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.blocked by 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.audit stream (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 drain and revive, with no failed publishes.
  • The game day from Failure Scenarios.

Stretch goals

  • Federate orders to 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.audit into a Kafka topic for analytics.
  • Use the stream protocol (rstream) for the audit consumer and compare throughput with AMQP.

On this page