A comprehensive, hands-on guide to mastering RabbitMQ using Python and the pika library. This repository contains a step-by-step progression through all major messaging patterns, from simple queues to complex RPC systems.
Each directory represents a core messaging pattern, complete with its own automated Docker setup, implementation scripts, and detailed documentation.
- 01-basic-messaging: Introduction to Point-to-Point (P2P) messaging.
- 02-work-queues: Distributing heavy tasks among multiple workers using Fair Dispatch.
- 03-fanout-exchange: Broadcasting messages to multiple consumers using Fanout Exchange.
- 04-direct-exchange: Selective message delivery based on severity levels using Direct Exchange.
- 05-topic-exchange: Advanced pattern-based routing using Wildcards (
*,#) and Topic Exchange. - 06-rpc: Implementing Request/Reply communication (Remote Procedure Call).
- Broker: RabbitMQ (via Docker)
- Language: Python 3.x
- Client Library: Pika
- Automation: Bash scripting for multi-terminal orchestration.
Every pattern includes a run_demo.sh script that automates the entire process:
- Starts the RabbitMQ container.
- Waits for the broker to be healthy.
- Launches multiple terminals for Workers and Publishers.
# Example: Running the Routing pattern
cd 04-direct-exchange
chmod +x run_demo.sh
./run_demo.sh- Reliability: Message persistence and manual acknowledgments (ACKs).
- Scalability: Load balancing between multiple consumers.
- Flexibility: Dynamic routing using various Exchange types.
- Automation: Health-checking the broker before execution.
Created by Yinon Ozery - Feel free to explore and use this as a reference for your own distributed systems